From: Marius Gavrilescu Date: Wed, 17 Jun 2015 13:06:27 +0000 (+0300) Subject: Replace precomputed LUV constants with compile-time expressions X-Git-Tag: 0.002~6 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=af9d49f1d8e98ba73e8dca0287c7a73cab1c2eb1;p=convert-color-husl.git Replace precomputed LUV constants with compile-time expressions --- 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');