color-management: parametrize bt1886
This commit is contained in:
parent
c37567f1cd
commit
ef1727a186
8 changed files with 189 additions and 85 deletions
19
src/theme.rs
19
src/theme.rs
|
|
@ -1,7 +1,10 @@
|
|||
#![expect(clippy::excessive_precision)]
|
||||
|
||||
use {
|
||||
crate::{cmm::cmm_eotf::Eotf, utils::clonecell::CloneCell},
|
||||
crate::{
|
||||
cmm::cmm_eotf::{Eotf, bt1886_eotf_args, bt1886_inv_eotf_args},
|
||||
utils::clonecell::CloneCell,
|
||||
},
|
||||
num_traits::Float,
|
||||
std::{cell::Cell, cmp::Ordering, ops::Mul, sync::Arc},
|
||||
};
|
||||
|
|
@ -114,8 +117,13 @@ impl Color {
|
|||
match eotf {
|
||||
Eotf::Linear => convert!(linear),
|
||||
Eotf::St2084Pq => convert!(st2084_pq),
|
||||
Eotf::Bt1886 => convert!(gamma24),
|
||||
Eotf::Bt1886(c) => {
|
||||
let [a1, a2, a3, a4] = bt1886_eotf_args(c);
|
||||
let bt1886 = |c: f32| -> f32 { a1 * ((a2 * c + a3).powf(2.4) - a4) };
|
||||
convert!(bt1886)
|
||||
}
|
||||
Eotf::Gamma22 => convert!(gamma22),
|
||||
Eotf::Gamma24 => convert!(gamma24),
|
||||
Eotf::Gamma28 => convert!(gamma28),
|
||||
Eotf::St240 => convert!(st240),
|
||||
Eotf::Log100 => convert!(log100),
|
||||
|
|
@ -244,8 +252,13 @@ impl Color {
|
|||
match eotf {
|
||||
Eotf::Linear => convert!(linear),
|
||||
Eotf::St2084Pq => convert!(st2084_pq),
|
||||
Eotf::Bt1886 => convert!(gamma24),
|
||||
Eotf::Bt1886(c) => {
|
||||
let [a1, a2, a3, a4] = bt1886_inv_eotf_args(c);
|
||||
let bt1886 = |c: f32| -> f32 { a1 * ((a2 * c + a3).powf(1.0 / 2.4) - a4) };
|
||||
convert!(bt1886)
|
||||
}
|
||||
Eotf::Gamma22 => convert!(gamma22),
|
||||
Eotf::Gamma24 => convert!(gamma24),
|
||||
Eotf::Gamma28 => convert!(gamma28),
|
||||
Eotf::St240 => convert!(st240),
|
||||
Eotf::Log100 => convert!(log100),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue