all: split reusable components into workspace crates
This commit is contained in:
parent
2a079ed800
commit
657e7ce2f7
225 changed files with 7422 additions and 17602 deletions
|
|
@ -1,60 +0,0 @@
|
|||
use crate::utils::ordered_float::F32;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Eotf {
|
||||
Linear,
|
||||
St2084Pq,
|
||||
Bt1886(F32),
|
||||
Gamma22,
|
||||
Gamma24,
|
||||
Gamma28,
|
||||
St240,
|
||||
Log100,
|
||||
Log316,
|
||||
St428,
|
||||
Pow(EotfPow),
|
||||
CompoundPower24,
|
||||
}
|
||||
|
||||
const MUL: u32 = 10_000;
|
||||
const MUL_F32: f32 = MUL as f32;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
|
||||
pub struct EotfPow(pub u32);
|
||||
|
||||
impl EotfPow {
|
||||
pub const MIN: Self = Self(10_000);
|
||||
pub const LINEAR: Self = Self(10_000);
|
||||
pub const GAMMA22: Self = Self(22_000);
|
||||
pub const GAMMA24: Self = Self(24_000);
|
||||
pub const GAMMA28: Self = Self(28_000);
|
||||
pub const MAX: Self = Self(100_000);
|
||||
|
||||
pub fn eotf_f32(self) -> f32 {
|
||||
self.0 as f32 / MUL_F32
|
||||
}
|
||||
|
||||
pub fn inv_eotf_f32(self) -> f32 {
|
||||
MUL_F32 / self.0 as f32
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bt1886_eotf_args(c: F32) -> [f32; 4] {
|
||||
let c = c.0;
|
||||
let gamma = 1.0 / 2.4;
|
||||
let a1 = 1.0 / (1.0 - c);
|
||||
let a2 = 1.0 - c.powf(gamma);
|
||||
let a3 = c.powf(gamma);
|
||||
let a4 = c;
|
||||
[a1, a2, a3, a4]
|
||||
}
|
||||
|
||||
pub fn bt1886_inv_eotf_args(c: F32) -> [f32; 4] {
|
||||
let c = c.0;
|
||||
let gamma = 1.0 / 2.4;
|
||||
let a1 = 1.0 / (1.0 - c.powf(gamma));
|
||||
let a2 = 1.0 - c;
|
||||
let a3 = c;
|
||||
let a4 = c.powf(gamma);
|
||||
[a1, a2, a3, a4]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue