diff --git a/Cargo.lock b/Cargo.lock index 75712ed..04ca3ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,7 +163,7 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorutils-rs" -version = "0.2.0" +version = "0.2.2" dependencies = [ "half", ] diff --git a/Cargo.toml b/Cargo.toml index 67892df..27c685b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ workspace = { members = ["src/app"] } [package] name = "colorutils-rs" -version = "0.2.1" +version = "0.2.2" edition = "2021" description = "Hig performance utilities for color format handling and conversion." readme = "README.md" diff --git a/src/image_to_xyz_lab.rs b/src/image_to_xyz_lab.rs index a6b804f..b55fb00 100644 --- a/src/image_to_xyz_lab.rs +++ b/src/image_to_xyz_lab.rs @@ -65,7 +65,7 @@ fn channels_to_xyz( cx, src.as_ptr(), diff --git a/src/rgb_expand.rs b/src/rgb_expand.rs index ee7756b..5038036 100644 --- a/src/rgb_expand.rs +++ b/src/rgb_expand.rs @@ -24,18 +24,19 @@ pub fn rgb_to_rgba( let mut src_offset = 0usize; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] - let mut use_sse = false; + let mut _use_sse = false; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] - let mut use_avx = false; + let mut _use_avx = false; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] { if is_x86_feature_detected!("sse4.1") { - use_sse = true; + _use_sse = true; } + #[cfg(target_feature = "avx2")] if is_x86_feature_detected!("avx2") { - use_avx = true; + _use_avx = true; } } @@ -47,7 +48,7 @@ pub fn rgb_to_rgba( unsafe { let src_ptr = src.as_ptr().add(src_offset); let dst_ptr = dst.as_mut_ptr().add(dst_offset); - if use_avx { + if _use_avx { let v_alpha = _mm256_set1_epi8(default_alpha as i8); while cx + 32 < width as usize { let xyz_chan_ptr = src_ptr.add(cx * 3usize); @@ -66,7 +67,7 @@ pub fn rgb_to_rgba( cx += 32; } } - if use_sse { + if _use_sse { let v_alpha = _mm_set1_epi8(default_alpha as i8); while cx + 16 < width as usize { let xyz_chan_ptr = src_ptr.add(cx * 3usize); @@ -105,7 +106,7 @@ pub fn rgb_to_rgba( dst[dst_offset + x * 4] = src[src_offset + x * 3]; dst[dst_offset + x * 4 + 1] = src[src_offset + x * 3 + 1]; dst[dst_offset + x * 4 + 2] = src[src_offset + x * 3 + 2]; - dst[dst_offset + x * 4 + 3] = 255; + dst[dst_offset + x * 4 + 3] = default_alpha; } dst_offset += dst_stride as usize; diff --git a/src/sse_math.rs b/src/sse_math.rs index 4bf8e5e..abe6c06 100644 --- a/src/sse_math.rs +++ b/src/sse_math.rs @@ -245,7 +245,7 @@ pub(crate) unsafe fn _mm_neg_epi32(x: __m128i) -> __m128i { #[inline(always)] #[allow(dead_code)] /// This is Cube Root using Pow functions, -/// it also precise however due to of inexact nature of power 1/3 result slightly differ +/// it is also precise however due to of inexact nature of power 1/3 result slightly differ /// from real cbrt with about ULP 3-4, but this is almost 2 times faster than cbrt with real ULP 3.5 pub unsafe fn _mm_cbrt_ps(d: __m128) -> __m128 { _mm_pow_n_ps(d, 1f32 / 3f32)