[babl] palette: expect palettes/formats to be gamma corrected in 8bit



commit fabcc6729ed453fb5c5affc565d0e837a78afc5c
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Jan 3 17:12:41 2018 +0100

    palette: expect palettes/formats to be gamma corrected in 8bit
    
    A correctness correction related to bug #763581 the formats wanted
    by GIMP and expected are gamma corrected not linear, I expect this
    fix either does not much for GIMP or fixes an unknown 8bit linear
    vs gamma quantization problem that has been lurking in INDEXED mode.

 babl/babl-palette.c |   18 +++++++++---------
 tests/palette.c     |    2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/babl/babl-palette.c b/babl/babl-palette.c
index fda96ae..7a06e7d 100644
--- a/babl/babl-palette.c
+++ b/babl/babl-palette.c
@@ -136,7 +136,7 @@ static BablPalette *make_pal (const Babl *format, const void *data, int count)
 
   babl_process (babl_fish (format, babl_format ("RGBA double")),
                 data, pal->data_double, count);
-  babl_process (babl_fish (format, babl_format ("RGBA u8")),
+  babl_process (babl_fish (format, babl_format ("R'G'B'A u8")),
                 data, pal->data_u8, count);
 
   babl_palette_reset_hash (pal);
@@ -161,10 +161,10 @@ static BablPalette *default_palette (void)
   memset (&pal, 0, sizeof (pal));
   inited = 1;
   pal.count = 16;
-  pal.format = babl_format ("RGBA u8"); /* dynamically generated, so
-                                           the default palette can
-                                           not be fully static.
-                                         */
+  pal.format = babl_format ("R'G'B'A u8"); /* dynamically generated, so
+                                              the default palette can
+                                              not be fully static.
+                                            */
   pal.data = defpal_data;
   pal.data_double = defpal_double;
   pal.data_u8 = defpal_data;
@@ -576,7 +576,7 @@ const Babl *babl_new_palette (const char  *name,
 
   babl_conversion_new (
      f_pal_u8,
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      "linear", pal_u8_to_rgba_u8,
      "data", palptr,
      NULL);
@@ -584,19 +584,19 @@ const Babl *babl_new_palette (const char  *name,
 
   babl_conversion_new (
      f_pal_a_u8,
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      "linear", pala_u8_to_rgba_u8,
      "data", palptr,
      NULL);
 
   babl_conversion_new (
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      f_pal_a_u8,
      "linear", rgba_u8_to_pal_a,
      "data", palptr,
      NULL);
   babl_conversion_new (
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      f_pal_u8,
      "linear", rgba_u8_to_pal,
      "data", palptr,
diff --git a/tests/palette.c b/tests/palette.c
index 8519262..ce21cf6 100644
--- a/tests/palette.c
+++ b/tests/palette.c
@@ -40,7 +40,7 @@ main (int    argc,
     assert (palA);
 
     CHECK_CONV("pal to rgba", unsigned char,
-        palA, babl_format("RGBA u8"),
+        palA, babl_format("R'G'B'A u8"),
         in, out);
   }
   if(0){


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