[babl] babl: move to/from xyz and rgbtoxyz matrix functions out of babl.h



commit 286958ef98d33ad7ff7ea6b6f5b5ed8f7043dfba
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Oct 3 16:41:26 2017 +0200

    babl: move to/from xyz and rgbtoxyz matrix functions out of babl.h
    
    Both of these are useful, but we might want a wider range, permitting
    both linear and non-linear variants to be converted to both XYZ and LAB.
    
    The matrix is for now used in babl for the RGB->Y conversion - this might
    warrant a more direct API.

 babl/babl-internal.h |   19 +++++++++++++++++++
 babl/babl.h          |   18 ------------------
 extensions/CIE.c     |    2 +-
 extensions/float.c   |    5 +++--
 extensions/grey.c    |   14 +++-----------
 5 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 3a7676e..4a57932 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -467,4 +467,23 @@ const char *babl_space_to_icc (const Babl  *space,
                                BablICCFlags flags,
                                int         *icc_length);
 
+/* babl_space_get_rgbtoxyz:
+
+   Returns the double-precision 3x3 matrix used to convert linear
+   RGB data to CIE XYZ.
+ */
+const double * babl_space_get_rgbtoxyz (const Babl *space);
+
+/* babl_space_to_xyz:
+ *
+ * converts a double triplet from linear RGB to CIE XYZ.
+ */
+void babl_space_to_xyz   (const Babl *space, const double *rgb, double *xyz);
+
+/* babl_space_from_xyz:
+ *
+ * converts double triplet from CIE XYZ to linear RGB
+ */
+void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
+
 #endif
diff --git a/babl/babl.h b/babl/babl.h
index ac83fd7..f97e036 100644
--- a/babl/babl.h
+++ b/babl/babl.h
@@ -146,24 +146,6 @@ char *babl_icc_get_key (const char *icc_data,
                         const char *language,
                         const char *counter);
 
-/* babl_space_get_rgbtoxyz:
-
-   Returns the internal, double-precision 3x3 matrix used to convert linear
-   RGB data to CIE XYZ.
- */
-const double * babl_space_get_rgbtoxyz (const Babl *space);
-
-/* babl_space_to_xyz:
- *
- * converts a double triplet from linear RGB to CIE XYZ.
- */
-void babl_space_to_xyz   (const Babl *space, const double *rgb, double *xyz);
-
-/* babl_space_from_xyz:
- *
- * converts double triplet from CIE XYZ to linear RGB
- */
-void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
 
 /**
  * babl_format:
diff --git a/extensions/CIE.c b/extensions/CIE.c
index 5bb353d..d16d862 100644
--- a/extensions/CIE.c
+++ b/extensions/CIE.c
@@ -22,7 +22,7 @@
 #include <math.h>
 #include <string.h>
 
-#include "babl.h"
+#include "babl-internal.h"
 #include "extensions/util.h"
 
 #define DEGREES_PER_RADIAN (180 / 3.14159265358979323846)
diff --git a/extensions/float.c b/extensions/float.c
index 1f4bb86..e832e2e 100644
--- a/extensions/float.c
+++ b/extensions/float.c
@@ -53,8 +53,9 @@ conv_rgbaF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
 }
 
 static INLINE void
-conv_rgbAF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src, 
-                               unsigned char *dst, 
+conv_rgbAF_linear_rgbAF_gamma (const Babl    *conversion,
+                               unsigned char *src,
+                               unsigned char *dst,
                                long           samples)
 {
    const Babl  *space = babl_conversion_get_destination_space (conversion);
diff --git a/extensions/grey.c b/extensions/grey.c
index 3b82812..8989fe5 100644
--- a/extensions/grey.c
+++ b/extensions/grey.c
@@ -19,19 +19,11 @@
 #include "config.h"
 #include <stdio.h>
 
-#include "babl.h"
+#include "babl-internal.h"
 
 #include "base/util.h"
 #include "extensions/util.h"
 
-/* There was some debate on #gimp about whether these constants
- * are accurate, for now I've elected to just follow whatever
- * babl/base does.
- *   - Daniel
- */
-
-/* Float versions of the double constants in rgb-constants.h */
-
 static void
 conv_rgbaF_linear_y8_linear (const Babl *conversion,unsigned char *src,
                              unsigned char *dst,
@@ -39,9 +31,9 @@ conv_rgbaF_linear_y8_linear (const Babl *conversion,unsigned char *src,
 {
   const Babl *space = babl_conversion_get_source_space (conversion);
   const double *rgbtoxyz = babl_space_get_rgbtoxyz (space);
-  const float RGB_LUMINANCE_RED_FLOAT = rgbtoxyz[3];
+  const float RGB_LUMINANCE_RED_FLOAT   = rgbtoxyz[3];
   const float RGB_LUMINANCE_GREEN_FLOAT = rgbtoxyz[4];
-  const float RGB_LUMINANCE_BLUE_FLOAT = rgbtoxyz[5];
+  const float RGB_LUMINANCE_BLUE_FLOAT  = rgbtoxyz[5];
 
   float *s = (float *) src;
   long   n = samples;


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