Skip to main content

pic_scale/
lib.rs

1/*
2 * Copyright (c) Radzivon Bartoshyk. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1.  Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * 2.  Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * 3.  Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29#![deny(deprecated)]
30// #![deny(unreachable_code, unused)]
31#![allow(stable_features, clippy::incompatible_msrv, unused_features)]
32#![allow(
33    clippy::too_many_arguments,
34    clippy::manual_clamp,
35    clippy::type_complexity
36)]
37#![cfg_attr(
38    all(feature = "nightly_i8mm", target_arch = "aarch64"),
39    feature(stdarch_neon_i8mm)
40)]
41#![cfg_attr(
42    all(feature = "nightly_avx512fp16", target_arch = "x86_64"),
43    feature(stdarch_x86_avx512_f16)
44)]
45#![cfg_attr(feature = "nightly_f16", feature(f16))]
46#![cfg_attr(
47    all(feature = "nightly_f16", target_arch = "aarch64"),
48    feature(stdarch_neon_f16)
49)]
50#![cfg_attr(docsrs, feature(doc_cfg))]
51#![cfg_attr(
52    all(feature = "sve", target_arch = "aarch64"),
53    feature(stdarch_aarch64_sve)
54)]
55
56mod alpha_check;
57#[cfg(feature = "nightly_f16")]
58mod alpha_handle_f16;
59mod alpha_handle_f32;
60mod alpha_handle_u16;
61mod alpha_handle_u8;
62#[cfg(all(target_arch = "x86_64", feature = "avx"))]
63mod avx2;
64#[cfg(all(target_arch = "x86_64", feature = "avx512"))]
65mod avx512;
66mod color_group;
67#[cfg(feature = "colorspaces")]
68mod colors;
69mod convolution;
70mod convolve_naive_f32;
71#[cfg(feature = "nightly_f16")]
72mod f16;
73mod factory;
74mod filter_weights;
75mod fixed_point_horizontal;
76mod fixed_point_vertical;
77mod floating_point_horizontal;
78mod floating_point_vertical;
79mod handler_provider;
80mod image_size;
81mod image_store;
82mod math;
83mod mixed_storage;
84mod mlaf;
85#[cfg(all(target_arch = "aarch64", feature = "neon"))]
86mod neon;
87mod plan;
88mod sampler;
89mod saturate_narrow;
90mod scaler;
91#[cfg(feature = "nightly_f16")]
92#[cfg_attr(docsrs, doc(cfg(feature = "nightly_f16")))]
93mod scaler_f16;
94#[cfg(all(any(target_arch = "x86_64", target_arch = "x86"), feature = "sse"))]
95mod sse;
96mod support;
97#[cfg(all(target_arch = "aarch64", feature = "sve"))]
98mod sve2;
99mod threading_policy;
100mod validation;
101#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
102mod wasm32;
103
104#[cfg(feature = "colorspaces")]
105pub use colors::*;
106#[cfg(feature = "colorspaces")]
107pub use colorutils_rs::TransferFunction;
108pub use factory::Ar30ByteOrder;
109pub use image_size::ImageSize;
110pub use image_store::{
111    BufferStore, CbCr8ImageStore, CbCr8ImageStoreMut, CbCr16ImageStore, CbCr16ImageStoreMut,
112    CbCrF32ImageStore, CbCrF32ImageStoreMut, GrayAlpha8ImageStore, GrayAlpha8ImageStoreMut,
113    GrayAlpha16ImageStore, GrayAlpha16ImageStoreMut, GrayAlphaF32ImageStore,
114    GrayAlphaF32ImageStoreMut, ImageStore, ImageStoreMut, Planar8ImageStore, Planar8ImageStoreMut,
115    Planar16ImageStore, Planar16ImageStoreMut, PlanarF32ImageStore, PlanarF32ImageStoreMut,
116    PlanarS16ImageStore, PlanarS16ImageStoreMut, Rgb8ImageStore, Rgb8ImageStoreMut,
117    Rgb16ImageStore, Rgb16ImageStoreMut, RgbF32ImageStore, RgbF32ImageStoreMut, Rgba8ImageStore,
118    Rgba8ImageStoreMut, Rgba16ImageStore, Rgba16ImageStoreMut, RgbaF32ImageStore,
119    RgbaF32ImageStoreMut,
120};
121#[cfg(feature = "nightly_f16")]
122#[cfg_attr(docsrs, doc(cfg(feature = "nightly_f16")))]
123pub use image_store::{
124    CbCrF16ImageStore, CbCrF16ImageStoreMut, PlanarF16ImageStore, PlanarF16ImageStoreMut,
125    RgbF16ImageStore, RgbF16ImageStoreMut, RgbaF16ImageStore, RgbaF16ImageStoreMut,
126};
127pub(crate) use math::*;
128pub use plan::{Resampling, ResamplingPlan};
129pub use sampler::*;
130pub use scaler::{ImageStoreScaling, Scaler, ScalingOptions, WorkloadStrategy};
131pub use threading_policy::ThreadingPolicy;
132pub use validation::{PicScaleBufferMismatch, PicScaleError};