#[cfg(all(
feature = "yuv-planar",
any(
target_arch = "aarch64",
target_arch = "x86_64",
target_arch = "wasm32"
)
))]
use crate::row::arch;
#[cfg(all(feature = "yuv-planar", target_arch = "aarch64"))]
use crate::row::neon_available;
#[cfg(all(feature = "yuv-planar", target_arch = "wasm32"))]
use crate::row::simd128_available;
#[cfg(all(feature = "yuv-planar", target_arch = "x86_64"))]
use crate::row::{avx2_available, avx512_available, sse41_available};
#[cfg(feature = "yuv-planar")]
use crate::{KernelMatrix, row::scalar};
#[cfg(feature = "yuv-planar")]
#[cfg_attr(not(tarpaulin), inline(always))]
#[allow(clippy::too_many_arguments)]
pub(crate) fn yuv_420p_n_to_hsv_row<const BITS: u32, const BE: bool>(
y: &[u16],
u_half: &[u16],
v_half: &[u16],
h_out: &mut [u8],
s_out: &mut [u8],
v_out: &mut [u8],
width: usize,
matrix: KernelMatrix,
full_range: bool,
use_simd: bool,
) {
assert_eq!(width & 1, 0, "YUV 4:2:0 requires even width");
assert!(y.len() >= width, "y row too short");
assert!(u_half.len() >= width / 2, "u_half row too short");
assert!(v_half.len() >= width / 2, "v_half row too short");
assert!(h_out.len() >= width, "h_out row too short");
assert!(s_out.len() >= width, "s_out row too short");
assert!(v_out.len() >= width, "v_out row too short");
if use_simd {
cfg_select! {
target_arch = "aarch64" => {
if neon_available() {
unsafe {
arch::neon::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
return;
}
}
target_arch = "x86_64" => {
if avx512_available() {
unsafe {
arch::x86_avx512::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
return;
}
if avx2_available() {
unsafe {
arch::x86_avx2::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
return;
}
if sse41_available() {
unsafe {
arch::x86_sse41::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
return;
}
}
target_arch = "wasm32" => {
if simd128_available() {
unsafe {
arch::wasm_simd128::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
return;
}
}
_ => {}
}
}
scalar::yuv_420p_n_to_hsv_row::<BITS, BE>(
y, u_half, v_half, h_out, s_out, v_out, width, matrix, full_range,
);
}
#[cfg(feature = "yuv-semi-planar")]
pub(super) mod p010;
#[cfg(feature = "yuv-semi-planar")]
pub(super) mod p012;
#[cfg(feature = "yuv-semi-planar")]
pub(super) mod p016;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv420p10;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv420p12;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv420p14;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv420p16;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv420p9;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv_410;
#[cfg(feature = "yuv-planar")]
pub(super) mod yuv_420;
#[cfg(feature = "yuv-semi-planar")]
pub use p010::*;
#[cfg(feature = "yuv-semi-planar")]
pub use p012::*;
#[cfg(feature = "yuv-semi-planar")]
pub use p016::*;
#[cfg(feature = "yuv-planar")]
pub use yuv_410::*;
#[cfg(feature = "yuv-planar")]
pub use yuv_420::*;
#[cfg(feature = "yuv-planar")]
pub use yuv420p9::*;
#[cfg(feature = "yuv-planar")]
pub use yuv420p10::*;
#[cfg(feature = "yuv-planar")]
pub use yuv420p12::*;
#[cfg(feature = "yuv-planar")]
pub use yuv420p14::*;
#[cfg(feature = "yuv-planar")]
pub use yuv420p16::*;