1
0
Fork 0
forked from wry/wry

color-management: parametrize bt1886

This commit is contained in:
Julian Orth 2025-09-08 20:37:47 +02:00
parent c37567f1cd
commit ef1727a186
8 changed files with 189 additions and 85 deletions

View file

@ -1,9 +1,12 @@
use crate::utils::ordered_float::F32;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum Eotf {
Linear,
St2084Pq,
Bt1886,
Bt1886(F32),
Gamma22,
Gamma24,
Gamma28,
St240,
Log100,
@ -34,3 +37,23 @@ impl EotfPow {
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]
}