From af9d49f1d8e98ba73e8dca0287c7a73cab1c2eb1 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 17 Jun 2015 16:06:27 +0300 Subject: [PATCH] Replace precomputed LUV constants with compile-time expressions --- lib/Convert/Color/LUV.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Convert/Color/LUV.pm b/lib/Convert/Color/LUV.pm index 886deb7..76d9b8f 100644 --- a/lib/Convert/Color/LUV.pm +++ b/lib/Convert/Color/LUV.pm @@ -10,11 +10,16 @@ use Convert::Color::XYZ; our $VERSION = '0.001'; use constant +{ ## no critic (Capitalization) - KAPPA => 903.2962962, - EPS => 0.0088564516, + KAPPA => (29/3) ** 3, + EPS => (6/29) ** 3, - REF_U => 0.19783000664283, - REF_V => 0.46831999493879, + REF_X => 3127/3290, + REF_Z => 3583/3290, +}; + +use constant +{ ## no critic (Capitalization) + REF_U => 4 * REF_X / (REF_X + 15 + 3 * REF_Z), + REF_V => 9 / (REF_X + 15 + 3 * REF_Z), }; __PACKAGE__->register_color_space('luv'); -- 2.39.2