From cd8395b2a40a41c38212ca3cdb9f10bfc12e5559 Mon Sep 17 00:00:00 2001 From: Beinsezii Date: Wed, 26 Jun 2024 17:55:00 -0700 Subject: [PATCH] Update constant representations to be formulaic It's how they're defined in the paper --- src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index eccf1eb..d0ae328 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -229,17 +229,17 @@ const SRGBEOTF_CHI_INV: f32 = 0.0031308; const LAB_DELTA: f32 = 6.0 / 29.0; // -const PQEOTF_M1: f32 = 0.1593017578125; -const PQEOTF_M2: f32 = 78.84375; -const PQEOTF_C1: f32 = 0.8359375; -const PQEOTF_C2: f32 = 18.8515625; -const PQEOTF_C3: f32 = 18.6875; +const PQEOTF_M1: f32 = 2610. / 16384.; +const PQEOTF_M2: f32 = 2523. / 4096. * 128.; +const PQEOTF_C1: f32 = 3424. / 4096.; +const PQEOTF_C2: f32 = 2413. / 4096. * 32.; +const PQEOTF_C3: f32 = 2392. / 4096. * 32.; // JzAzBz const JZAZBZ_B: f32 = 1.15; const JZAZBZ_G: f32 = 0.66; const JZAZBZ_D: f32 = -0.56; -const JZAZBZ_D0: f32 = 1.6295499532821566 * 1e-11; +const JZAZBZ_D0: f32 = 1.6295499532821566e-11; const JZAZBZ_P: f32 = 1.7 * PQEOTF_M2; // ### CONSTS ### }}} @@ -313,14 +313,14 @@ const JZAZBZ_M2_INV: [[f32; 3]; 3] = [ // ICtCp const ICTCP_M1: [[f32; 3]; 3] = [ - [1688.0 / 4096.0, 2146.0 / 4096.0, 262.0 / 4096.0], - [683.0 / 4096.0, 2951.0 / 4096.0, 462.0 / 4096.0], - [99.0 / 4096.0, 309.0 / 4096.0, 3688.0 / 4096.0], + [1688. / 4096., 2146. / 4096., 262. / 4096.], + [683. / 4096., 2951. / 4096., 462. / 4096.], + [99. / 4096., 309. / 4096., 3688. / 4096.], ]; const ICTCP_M2: [[f32; 3]; 3] = [ - [2048.0 / 4096.0, 2048.0 / 4096.0, 0.0 / 4096.0], - [6610.0 / 4096.0, -13613.0 / 4096.0, 7003.0 / 4096.0], - [17933.0 / 4096.0, -17390.0 / 4096.0, -543.0 / 4096.0], + [2048. / 4096., 2048. / 4096., 0. / 4096.], + [6610. / 4096., -13613. / 4096., 7003. / 4096.], + [17933. / 4096., -17390. / 4096., -543. / 4096.], ]; const ICTCP_M1_INV: [[f32; 3]; 3] = [