Skip to content

Commit

Permalink
Refactor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Jun 7, 2024
1 parent 14e7971 commit 61077c6
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 27 deletions.
11 changes: 2 additions & 9 deletions src/avx2_to_xyz_lab.rs → src/avx/avx2_to_xyz_lab.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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"))]
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/avx_gamma_curves.rs → src/avx/avx_gamma_curves.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions src/avx/mod.rs
Original file line number Diff line number Diff line change
@@ -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::*;
4 changes: 2 additions & 2 deletions src/concat_alpha.rs
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions src/image_to_xyz_lab.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/rgb_expand.rs
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions src/sse/mod.rs
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
2 changes: 0 additions & 2 deletions src/sse/sse_linear_to_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
3 changes: 1 addition & 2 deletions src/sse/sse_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 61077c6

Please sign in to comment.