e
nightly fix
| -rwxr-xr-x | Cargo.lock | 4 | ||||
| -rwxr-xr-x | Cargo.toml | 6 | ||||
| -rwxr-xr-x | src/color.rs | 13 | ||||
| -rwxr-xr-x | src/color/simd.rs | 37 | ||||
| -rwxr-xr-x | src/lib.rs | 10 |
5 files changed, 18 insertions, 52 deletions
@@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "cfg-if" @@ -33,7 +33,7 @@ dependencies = [ [[package]] name = "slur" -version = "0.1.0" +version = "0.1.1" dependencies = [ "iai", "imgref", @@ -1,11 +1,11 @@ [package] name = 'slur' -version = '0.1.0' +version = '0.1.1' authors = ['LoganDark'] -edition = '2021' +edition = '2024' description = 'A fast, iterative, correct approach to Stackblur, resulting in a very smooth and high-quality output, with no edge bleeding' readme = 'README.md' -repository = 'https://github.com/bend-n/slur' +repository = 'https://git.bendn.org/slur' license = 'MIT' keywords = ['stackblur', 'blur', 'gaussian'] categories = ['algorithms', 'graphics', 'rendering'] diff --git a/src/color.rs b/src/color.rs index 96efe3b..780f0c3 100755 --- a/src/color.rs +++ b/src/color.rs @@ -6,8 +6,7 @@ mod simd; pub use serial::BlurU32; pub use simd::u32xN; - -use std::simd::{LaneCount, Simd, SupportedLaneCount}; +use std::simd::prelude::*; #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Debug, Default)] @@ -28,10 +27,7 @@ impl From<Argb<BlurU32>> for u32 { } } -impl<const N: usize> From<[u32; N]> for Argb<u32xN<N>> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> From<[u32; N]> for Argb<u32xN<N>> { fn from(values: [u32; N]) -> Self { let arrs: [[u8; 4]; N] = values.map(u32::to_be_bytes); Self([ @@ -43,10 +39,7 @@ where } } -impl<const N: usize> From<Argb<u32xN<N>>> for [u32; N] -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> From<Argb<u32xN<N>>> for [u32; N] { fn from(value: Argb<u32xN<N>>) -> Self { let [a, r, g, b] = value.0.map(|i| i.0.to_array()); std::array::from_fn(|i| u32::from_be_bytes([a[i], r[i], g[i], b[i]].map(|x| x as u8))) diff --git a/src/color/simd.rs b/src/color/simd.rs index 3b0e593..78b1f76 100755 --- a/src/color/simd.rs +++ b/src/color/simd.rs @@ -1,17 +1,11 @@ use std::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign}; - -pub use std::simd::{LaneCount, Simd, SupportedLaneCount}; +use std::simd::prelude::*; #[derive(Copy, Clone, Eq, PartialEq, Debug, Default)] #[allow(non_camel_case_types)] -pub struct u32xN<const N: usize>(pub Simd<u32, N>) -where - LaneCount<N>: SupportedLaneCount; +pub struct u32xN<const N: usize>(pub Simd<u32, N>); -impl<const N: usize> Add for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> Add for u32xN<N> { type Output = Self; fn add(self, rhs: Self) -> Self::Output { @@ -19,10 +13,7 @@ where } } -impl<const N: usize> Sub for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> Sub for u32xN<N> { type Output = Self; fn sub(self, rhs: Self) -> Self::Output { @@ -30,28 +21,19 @@ where } } -impl<const N: usize> AddAssign for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> AddAssign for u32xN<N> { fn add_assign(&mut self, rhs: Self) { self.0 += rhs.0; } } -impl<const N: usize> SubAssign for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> SubAssign for u32xN<N> { fn sub_assign(&mut self, rhs: Self) { self.0 -= rhs.0; } } -impl<const N: usize> Mul<usize> for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> Mul<usize> for u32xN<N> { type Output = Self; fn mul(self, rhs: usize) -> Self::Output { @@ -59,10 +41,7 @@ where } } -impl<const N: usize> Div<usize> for u32xN<N> -where - LaneCount<N>: SupportedLaneCount, -{ +impl<const N: usize> Div<usize> for u32xN<N> { type Output = Self; fn div(self, rhs: usize) -> Self::Output { @@ -49,7 +49,6 @@ #![cfg_attr(test, feature(test))] use std::collections::VecDeque; -use std::simd::{LaneCount, SupportedLaneCount}; pub extern crate imgref; @@ -114,9 +113,7 @@ pub fn simd_blur<T, Bsimd: StackBlurrable, Bsingle: StackBlurrable, const LANES: mut to_pixel_simd: impl FnMut(Bsimd) -> [T; LANES], mut to_blurrable_single: impl FnMut(&T) -> Bsingle, mut to_pixel_single: impl FnMut(Bsingle) -> T, -) where - LaneCount<LANES>: SupportedLaneCount, -{ +) { #[cfg(not(doc))] use imgref_iter::iter::{ SimdIterWindow, SimdIterWindowPtrMut, SimdIterWindows, SimdIterWindowsPtrMut, @@ -190,10 +187,7 @@ pub fn blur_argb(buffer: &mut ImgRefMut<u32>, radius: usize) { /// /// This is a version of [`simd_blur`] with pre-filled conversion routines that /// provide good results for blur radii <= 4096. Larger radii may overflow. -pub fn simd_blur_argb<const LANES: usize>(buffer: &mut ImgRefMut<u32>, radius: usize) -where - LaneCount<LANES>: SupportedLaneCount, -{ +pub fn simd_blur_argb<const LANES: usize>(buffer: &mut ImgRefMut<u32>, radius: usize) { simd_blur( buffer, radius, |