From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/jpeg-decoder/src/arch/mod.rs | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 vendor/jpeg-decoder/src/arch/mod.rs (limited to 'vendor/jpeg-decoder/src/arch/mod.rs') diff --git a/vendor/jpeg-decoder/src/arch/mod.rs b/vendor/jpeg-decoder/src/arch/mod.rs new file mode 100644 index 0000000..15b46c5 --- /dev/null +++ b/vendor/jpeg-decoder/src/arch/mod.rs @@ -0,0 +1,46 @@ +#![allow(unsafe_code)] + +mod neon; +mod ssse3; + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use std::is_x86_feature_detected; + +/// Arch-specific implementation of YCbCr conversion. Returns the number of pixels that were +/// converted. +pub fn get_color_convert_line_ycbcr() -> Option usize> +{ + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[allow(unsafe_code)] + { + if is_x86_feature_detected!("ssse3") { + return Some(ssse3::color_convert_line_ycbcr); + } + } + // Runtime detection is not needed on aarch64. + #[cfg(all(feature = "nightly_aarch64_neon", target_arch = "aarch64"))] + { + return Some(neon::color_convert_line_ycbcr); + } + #[allow(unreachable_code)] + None +} + +/// Arch-specific implementation of 8x8 IDCT. +pub fn get_dequantize_and_idct_block_8x8( +) -> Option { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[allow(unsafe_code)] + { + if is_x86_feature_detected!("ssse3") { + return Some(ssse3::dequantize_and_idct_block_8x8); + } + } + // Runtime detection is not needed on aarch64. + #[cfg(all(feature = "nightly_aarch64_neon", target_arch = "aarch64"))] + { + return Some(neon::dequantize_and_idct_block_8x8); + } + #[allow(unreachable_code)] + None +} -- cgit v1.2.3