[babl] CIE: Use cbrt instead of pow for the reference XYZ to LAB conversion



commit ab883c55fa74dfaeb27d488f0bd5de53fd1b1afb
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 31 09:36:39 2017 +0100

    CIE: Use cbrt instead of pow for the reference XYZ to LAB conversion
    
    The fast-paths use an inlining-friendly version of cbrt(3). Using
    something similar removes superficial differences between the two
    conversion paths. It's not like the C library's cbrt(3) will perform
    any worse than its own pow(3).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789695

 extensions/CIE.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/extensions/CIE.c b/extensions/CIE.c
index a010f0b..e93b985 100644
--- a/extensions/CIE.c
+++ b/extensions/CIE.c
@@ -168,13 +168,13 @@ XYZ_to_LAB (double X,
   double y_r = Y / D50_WHITE_REF_Y;
   double z_r = Z / D50_WHITE_REF_Z;
 
-  if (x_r > LAB_EPSILON) f_x = pow(x_r, 1.0 / 3.0);
+  if (x_r > LAB_EPSILON) f_x = cbrt(x_r);
   else ( f_x = ((LAB_KAPPA * x_r) + 16) / 116.0 );
 
-  if (y_r > LAB_EPSILON) f_y = pow(y_r, 1.0 / 3.0);
+  if (y_r > LAB_EPSILON) f_y = cbrt(y_r);
   else ( f_y = ((LAB_KAPPA * y_r) + 16) / 116.0 );
 
-  if (z_r > LAB_EPSILON) f_z = pow(z_r, 1.0 / 3.0);
+  if (z_r > LAB_EPSILON) f_z = cbrt(z_r);
   else ( f_z = ((LAB_KAPPA * z_r) + 16) / 116.0 );
 
   *to_L = (116.0 * f_y) - 16.0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]