p_chan/
lib.rs

1//! Multimedia (Audio, Raster) Channel Newtypes and Conversions
2//!
3//! The `unsigned` and `signed` modules are enabled by features with the same
4//! name.
5//!
6//! The types provided by the `unsigned` and `signed` module are `Ch8`, `Ch12`,
7//! `Ch16`, `Ch24` for integers, and `Ch32` and `Ch64` for floating-point.
8//!
9//! Math operations on integer channels won't exceed the range of their minimum
10//! and maximum values, while math on floating-point channels can.
11//! Math operations on floating-point channels will only result in normal
12//! numbers or ±infinity.  Floating-point channels implement [`Eq`] and [`Ord`]
13//! since NaN is always flushed to zero.
14//!
15//! Channels support casting with the [`bytemuck`] crate, after which integer
16//! channels may contain out of range values and floating-point channels could
17//! contain NaN or denormals.  To flush denormals and NaN to zero and clamp
18//! integer ranges you can use [`ops::Difference::sub()`] on each channel value.
19
20#![no_std]
21#![deny(
22    missing_copy_implementations,
23    missing_debug_implementations,
24    missing_docs,
25    unsafe_code
26)]
27#![warn(
28    anonymous_parameters,
29    nonstandard_style,
30    rust_2018_idioms,
31    single_use_lifetimes,
32    trivial_casts,
33    trivial_numeric_casts,
34    unreachable_pub,
35    unused_extern_crates,
36    unused_qualifications,
37    variant_size_differences
38)]
39#![doc(
40    html_logo_url = "https://raw.githubusercontent.com/AldaronLau/p-chan/v0/res/icon.png",
41    html_favicon_url = "https://raw.githubusercontent.com/AldaronLau/p-chan/v0/res/icon.png"
42)]
43
44pub use bytemuck;
45
46mod math;
47#[cfg(any(feature = "unsigned", feature = "signed"))]
48#[macro_use]
49mod macros;
50pub mod convert;
51pub mod downscale;
52pub mod ops;
53#[cfg(feature = "signed")]
54pub mod signed;
55#[cfg(feature = "unsigned")]
56pub mod unsigned;
57pub mod upscale;