[babl] babl: use babl_conversion_process where appropriate



commit c159b6314e11984ee390a6c793070868cb304c36
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jan 14 22:15:12 2018 +0100

    babl: use babl_conversion_process where appropriate
    
    Instead of overloading babl_process() with two tasks, both fishes and
    conversions, use the conversion specific API for conversions directly.

 babl/babl-conversion.h     |    2 +-
 babl/babl-fish-path.c      |    1 +
 babl/babl-fish-reference.c |   31 +++++++++++++++----------------
 babl/babl-fish.h           |    1 +
 export-symbols             |    1 -
 5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
index 25bbeea..f373e38 100644
--- a/babl/babl-conversion.h
+++ b/babl/babl-conversion.h
@@ -44,6 +44,7 @@ _BablConversion {
   const Babl            *destination;
   void (*dispatch) (const Babl *babl, const char *src, char *dst, long n,
                     void           *user_data);
+  void                  *data;  /* user data */
 
   long                   cost;
   double                 error;
@@ -53,7 +54,6 @@ _BablConversion {
       BablFuncPlane      plane;
       BablFuncPlanar     planar;
     } function;
-  void                  *data;  /* user data */
   int                    processings;
   long                   pixels;
 };
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 741f81e..dbfa4de 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -705,6 +705,7 @@ _babl_process (Babl *babl,
       case BABL_CONVERSION_LINEAR:
       case BABL_CONVERSION_PLANE:
       case BABL_CONVERSION_PLANAR:
+        babl_assert (0);
         babl_conversion_process (babl, source, destination, n);
         break;
 
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index a018566..072c10f 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -195,9 +195,8 @@ convert_to_double (BablFormat      *source_fmt,
           if (source_fmt->component[j] ==
               source_fmt->model->component[i])
             {
-              babl_process (assert_conversion_find (src_img->type[0],
-                                                    dst_img->type[0]),
-                            src_img, dst_img, n);
+              babl_conversion_process (assert_conversion_find (src_img->type[0], dst_img->type[0]),
+                                       (void*)src_img, (void*)dst_img, n);
               found = 1;
               break;
             }
@@ -266,9 +265,9 @@ convert_from_double (BablFormat *destination_fmt,
               src_img->data[0] =
                 destination_double_buf + (src_img->type[0]->bits / 8) * j;
 
-              babl_process (assert_conversion_find (src_img->type[0],
-                                                    dst_img->type[0]),
-                            src_img, dst_img, n);
+              babl_conversion_process (assert_conversion_find (src_img->type[0],
+                                       dst_img->type[0]),
+                                       (void*)src_img, (void*)dst_img, n);
               break;
             }
         }
@@ -305,9 +304,9 @@ ncomponent_convert_to_double (BablFormat       *source_fmt,
 
   dst_img->data[0] = source_double_buf;
 
-  babl_process (
+  babl_conversion_process (
     assert_conversion_find (src_img->type[0], dst_img->type[0]),
-    src_img, dst_img,
+    (void*)src_img, (void*)dst_img,
     n * source_fmt->components);
   babl_free (src_img);
   babl_free (dst_img);
@@ -339,9 +338,9 @@ ncomponent_convert_from_double (BablFormat *destination_fmt,
   dst_img->type[0] = destination_fmt->type[0];
   src_img->data[0] = destination_double_buf;
 
-  babl_process (
+  babl_conversion_process (
     assert_conversion_find (src_img->type[0], dst_img->type[0]),
-    src_img, dst_img,
+    (void*)src_img, (void*)dst_img,
     n * destination_fmt->components);
 
   dst_img->data[0] += dst_img->type[0]->bits / 8;
@@ -499,14 +498,14 @@ babl_fish_reference_process (const Babl *babl,
       );
     if (conv->class_type == BABL_CONVERSION_PLANAR)
       {
-        babl_process (
+        babl_conversion_process (
           conv,
-          source_image, rgba_image,
+          (void*)source_image, (void*)rgba_image,
           n);
       }
     else if (conv->class_type == BABL_CONVERSION_LINEAR)
       {
-        babl_process (
+        babl_conversion_process (
           conv,
           source_double_buf, rgba_double_buf,
           n);
@@ -535,14 +534,14 @@ babl_fish_reference_process (const Babl *babl,
       BABL (babl->fish.destination)->format.model);
     if (conv->class_type == BABL_CONVERSION_PLANAR)
       {
-        babl_process (
+        babl_conversion_process (
           conv,
-          rgba_image, destination_image,
+          (void*)rgba_image, (void*)destination_image,
           n);
       }
     else if (conv->class_type == BABL_CONVERSION_LINEAR)
       {
-        babl_process (
+        babl_conversion_process (
           conv,
           rgba_double_buf, destination_double_buf,
           n);
diff --git a/babl/babl-fish.h b/babl/babl-fish.h
index 954536a..9f0cdd6 100644
--- a/babl/babl-fish.h
+++ b/babl/babl-fish.h
@@ -32,6 +32,7 @@ typedef struct
   const Babl     *source;
   const Babl     *destination;
   void           (*dispatch) (const Babl *babl, const char *src, char *dst, long n);
+  void            *data;  /* user data */
   double          error;    /* the amount of noise introduced by the fish */
 
   /* instrumentation */
diff --git a/export-symbols b/export-symbols
index 46c7b5b..301acce 100644
--- a/export-symbols
+++ b/export-symbols
@@ -37,7 +37,6 @@ babl_palette_reset
 babl_palette_set_palette
 babl_process
 babl_process_rows
-babl_fish_process
 babl_sampling
 babl_set_user_data
 babl_space


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