1
0
Fork 0
forked from wry/wry

color-management: implement set_tf_power

This commit is contained in:
Julian Orth 2025-09-08 18:37:07 +02:00
parent a2d726e508
commit c37567f1cd
8 changed files with 121 additions and 28 deletions

View file

@ -9,4 +9,28 @@ pub enum Eotf {
Log100,
Log316,
St428,
Pow(EotfPow),
}
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
}
}