diff --git a/src/avx2_to_xyz_lab.rs b/src/avx/avx2_to_xyz_lab.rs similarity index 97% rename from src/avx2_to_xyz_lab.rs rename to src/avx/avx2_to_xyz_lab.rs index 2b17260..28b2c56 100644 --- a/src/avx2_to_xyz_lab.rs +++ b/src/avx/avx2_to_xyz_lab.rs @@ -1,9 +1,3 @@ -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::avx2_utils::*; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::avx_gamma_curves::*; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::avx_math::*; #[allow(unused_imports)] use crate::gamma_curves::TransferFunction; #[allow(unused_imports)] @@ -12,13 +6,12 @@ use crate::image::ImageConfiguration; use crate::image_to_xyz_lab::XyzTarget; #[allow(unused_imports)] use crate::neon_gamma_curves::*; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::x86_64_simd_support::*; #[cfg(target_arch = "x86")] use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +use crate::avx::*; +use crate::avx::avx_gamma_curves::{avx2_rec709_to_linear, avx2_srgb_to_linear}; use crate::luv::{LUV_CUTOFF_FORWARD_Y, LUV_MULTIPLIER_FORWARD_Y}; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] diff --git a/src/avx2_utils.rs b/src/avx/avx2_utils.rs similarity index 100% rename from src/avx2_utils.rs rename to src/avx/avx2_utils.rs diff --git a/src/avx_gamma_curves.rs b/src/avx/avx_gamma_curves.rs similarity index 97% rename from src/avx_gamma_curves.rs rename to src/avx/avx_gamma_curves.rs index 21d2709..e058c59 100644 --- a/src/avx_gamma_curves.rs +++ b/src/avx/avx_gamma_curves.rs @@ -1,11 +1,10 @@ #[allow(unused_imports)] use crate::gamma_curves::TransferFunction; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::avx_math::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; #[cfg(target_arch = "x86")] use std::arch::x86::*; +use crate::avx::avx_math::*; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] #[inline(always)] diff --git a/src/avx_math.rs b/src/avx/avx_math.rs similarity index 100% rename from src/avx_math.rs rename to src/avx/avx_math.rs diff --git a/src/x86_64_simd_support.rs b/src/avx/avx_support.rs similarity index 100% rename from src/x86_64_simd_support.rs rename to src/avx/avx_support.rs diff --git a/src/avx/mod.rs b/src/avx/mod.rs new file mode 100644 index 0000000..256599f --- /dev/null +++ b/src/avx/mod.rs @@ -0,0 +1,26 @@ +/* + * // Copyright (c) the Radzivon Bartoshyk. All rights reserved. + * // + * // Use of this source code is governed by a BSD-style + * // license that can be found in the LICENSE file. + */ + +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +mod avx2_to_xyz_lab; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +mod avx2_utils; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +mod avx_gamma_curves; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +mod avx_math; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +mod avx_support; + +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +pub use avx2_to_xyz_lab::*; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +pub use avx2_utils::*; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +pub use avx_math::*; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +pub use avx_support::*; \ No newline at end of file diff --git a/src/concat_alpha.rs b/src/concat_alpha.rs index 62abfb6..720b5a2 100644 --- a/src/concat_alpha.rs +++ b/src/concat_alpha.rs @@ -1,5 +1,3 @@ -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::x86_64_simd_support::{avx2_deinterleave_rgb_ps, avx2_interleave_rgba_ps}; #[cfg(all( any(target_arch = "aarch64", target_arch = "arm"), target_feature = "neon" @@ -12,6 +10,8 @@ use std::arch::x86_64::*; #[allow(unused_imports)] use std::slice; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +use crate::avx::*; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] use crate::sse::*; /// Adds alpha plane into an existing RGB/XYZ/LAB or other 3 plane image. Image will become RGBA, XYZa, LABa etc. diff --git a/src/image_to_xyz_lab.rs b/src/image_to_xyz_lab.rs index 823a248..0abb763 100644 --- a/src/image_to_xyz_lab.rs +++ b/src/image_to_xyz_lab.rs @@ -1,6 +1,3 @@ -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -#[allow(unused_imports)] -use crate::avx2_to_xyz_lab::*; use crate::gamma_curves::TransferFunction; use crate::image::ImageConfiguration; use crate::image_to_xyz_lab::XyzTarget::{LAB, LUV, XYZ}; @@ -12,6 +9,8 @@ use crate::neon_to_xyz_lab::neon_channels_to_xyz_or_lab; use crate::{Rgb, Xyz, SRGB_TO_XYZ_D65}; use std::slice; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +use crate::avx::avx2_channels_to_xyz_or_lab; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] use crate::sse::sse_channels_to_xyz_or_lab; pub(crate) enum XyzTarget { diff --git a/src/lib.rs b/src/lib.rs index f5ef3a3..0cce9c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,18 +12,13 @@ mod xyz_transform; mod image; mod neon_to_xyz_lab; mod xyz_lab_to_image; -mod x86_64_simd_support; mod neon_to_linear; mod image_to_linear; mod linear_to_image; mod neon_linear_to_image; mod neon_xyz_lab_to_image; mod concat_alpha; -mod avx_math; -mod avx_gamma_curves; mod rgb_expand; -mod avx2_to_xyz_lab; -mod avx2_utils; mod image_xyza_laba; mod neon_to_xyza_laba; mod xyza_laba_to_image; @@ -33,6 +28,7 @@ mod neon_to_linear_u8; mod linear_to_image_u8; mod sse; mod image_to_xyz_lab; +mod avx; pub use gamma_curves::*; pub use hsl::Hsl; diff --git a/src/rgb_expand.rs b/src/rgb_expand.rs index edd30fa..96382dd 100644 --- a/src/rgb_expand.rs +++ b/src/rgb_expand.rs @@ -1,5 +1,3 @@ -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::x86_64_simd_support::*; #[cfg(all( any(target_arch = "aarch64", target_arch = "arm"), target_feature = "neon" @@ -10,6 +8,8 @@ use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +use crate::avx::*; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] use crate::sse::*; /// Expands RGB to RGBA. diff --git a/src/sse/mod.rs b/src/sse/mod.rs index a53eb59..ab751b2 100644 --- a/src/sse/mod.rs +++ b/src/sse/mod.rs @@ -1,3 +1,10 @@ +/* + * // Copyright (c) the Radzivon Bartoshyk. All rights reserved. + * // + * // Use of this source code is governed by a BSD-style + * // license that can be found in the LICENSE file. + */ + #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] mod sse_image_to_linear_u8; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] diff --git a/src/sse/sse_linear_to_image.rs b/src/sse/sse_linear_to_image.rs index d460a7c..b370805 100644 --- a/src/sse/sse_linear_to_image.rs +++ b/src/sse/sse_linear_to_image.rs @@ -3,8 +3,6 @@ use crate::image::ImageConfiguration; #[allow(unused_imports)] use crate::sse::*; #[allow(unused_imports)] -use crate::x86_64_simd_support::*; -#[allow(unused_imports)] use crate::TransferFunction; #[cfg(target_arch = "x86")] use std::arch::x86::*; diff --git a/src/sse/sse_support.rs b/src/sse/sse_support.rs index 8eb7b85..3379922 100644 --- a/src/sse/sse_support.rs +++ b/src/sse/sse_support.rs @@ -2,8 +2,7 @@ use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::x86_64_simd_support::shuffle; +use crate::avx::shuffle; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] #[inline(always)]