]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1739
authorCristy <urban-warrior@imagemagick.org>
Fri, 11 Oct 2019 23:47:56 +0000 (19:47 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 11 Oct 2019 23:47:56 +0000 (19:47 -0400)
MagickCore/gem-private.h

index fa7bd12ab81e4cc5775fb668531d5a746982f594..0b78788578b28b784c4f6fb7b28bf0523a8ada00 100644 (file)
@@ -107,6 +107,9 @@ static inline void ConvertLabToXYZ(const double L,const double a,const double b,
 static inline void ConvertLuvToXYZ(const double L,const double u,const double v,
   double *X,double *Y,double *Z)
 {
+  double
+    gamma;
+
   assert(X != (double *) NULL);
   assert(Y != (double *) NULL);
   assert(Z != (double *) NULL);
@@ -114,9 +117,10 @@ static inline void ConvertLuvToXYZ(const double L,const double u,const double v,
     *Y=(double) pow((L+16.0)/116.0,3.0);
   else
     *Y=L/CIEK;
-  *X=((*Y*((39.0*L/(v+13.0*L*(9.0*D65Y/(D65X+15.0*D65Y+3.0*D65Z))))-5.0))+
-    5.0*(*Y))/((((52.0*L/(u+13.0*L*(4.0*D65X/(D65X+15.0*D65Y+3.0*D65Z))))-1.0)/
-    3.0)-(-1.0/3.0));
+  gamma=PerceptibleReciprocal((((52.0*L/(u+13.0*L*(4.0*D65X/(D65X+15.0*D65Y+
+    3.0*D65Z))))-1.0)/3.0)-(-1.0/3.0));
+  *X=gamma*((*Y*((39.0*L/(v+13.0*L*(9.0*D65Y/(D65X+15.0*D65Y+3.0*D65Z))))-5.0))+
+    5.0*(*Y));
   *Z=(*X*(((52.0*L/(u+13.0*L*(4.0*D65X/(D65X+15.0*D65Y+3.0*D65Z))))-1.0)/3.0))-
     5.0*(*Y);
 }