]> iEval git - convert-color-hsluv.git/commitdiff
Replace precomputed LUV constants with compile-time expressions
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 17 Jun 2015 13:06:27 +0000 (16:06 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 17 Jun 2015 13:06:27 +0000 (16:06 +0300)
lib/Convert/Color/LUV.pm

index 886deb736f1119adbd19c136ead0e7e2d3ef7424..76d9b8f45832c9d1eb9118d5d05842dc7389bda9 100644 (file)
@@ -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');
This page took 0.026242 seconds and 4 git commands to generate.