[babl] gray: add graya to rgba expanders
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] gray: add graya to rgba expanders
- Date: Mon, 19 Aug 2019 23:14:18 +0000 (UTC)
commit b6d40c439d69714bcd9cb9313582d4fa9c971a70
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Aug 20 00:19:32 2019 +0200
gray: add graya to rgba expanders
babl/babl-fish-path.c | 18 +++++++++++++++---
extensions/grey.c | 41 +++++++++++++++++++++++++++++++++++++++++
tools/babl-benchmark.c | 22 +++++++++++++++-------
3 files changed, 71 insertions(+), 10 deletions(-)
---
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 82b728ed4..c8911d192 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -601,6 +601,7 @@ babl_fish_path2 (const Babl *source,
get_conversion_path (&pc, (Babl *) source, 0, max_path_length (), tolerance);
+#if 0
/* second attempt,. at path length + 1*/
if (babl->fish_path.conversion_list->count == 0 &&
max_path_length () + 1 <= BABL_HARD_MAX_PATH_LENGTH)
@@ -615,6 +616,7 @@ babl_fish_path2 (const Babl *source,
}
#endif
}
+#endif
/* third attempt,. at path length + 2 */
if (babl->fish_path.conversion_list->count == 0 &&
@@ -624,12 +626,22 @@ babl_fish_path2 (const Babl *source,
#if 1
if (babl->fish_path.conversion_list->count)
{
- fprintf (stderr, "babl is using very long chain, should be optimized\n");
- babl_list_each (babl->fish_path.conversion_list, show_item, NULL);
+ //fprintf (stderr, "babl is a long chain, should be optimized\n");
+ //babl_list_each (babl->fish_path.conversion_list, show_item, NULL);
}
else
{
- fprintf (stderr, "babl is lacking conversion for %s to %s\n",
+ static int show_missing = -1;
+ if (show_missing < 0)
+ {
+ const char *val = getenv ("BABL_DEBUG_MISSING");
+ if (val && strcmp (val, "0"))
+ show_missing = 1;
+ else
+ show_missing = 0;
+ }
+ if (show_missing)
+ fprintf (stderr, "babl is lacking conversion for %s to %s\n",
babl_get_name (source), babl_get_name (destination));
}
#endif
diff --git a/extensions/grey.c b/extensions/grey.c
index 11ad58793..3f208426c 100644
--- a/extensions/grey.c
+++ b/extensions/grey.c
@@ -107,6 +107,28 @@ conv_rgbaF_linear_yaF_linear (const Babl *conversion,
}
}
+static void
+conv_yaF_linear_rgbaF_linear (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *s = (float *) src;
+ float *d = (float *) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ float value;
+ value = *s++;
+ *d++ = value;
+ *d++ = value;
+ *d++ = value;
+ *d++ = *s++; /* alpha */
+ }
+}
+
+
int init (void);
int
@@ -130,5 +152,24 @@ init (void)
conv_rgbaF_linear_yaF_linear,
NULL);
+
+ babl_conversion_new (babl_format ("YA float"),
+ babl_format ("RGBA float"),
+ "linear",
+ conv_yaF_linear_rgbaF_linear,
+ NULL);
+
+ babl_conversion_new (babl_format ("YaA float"),
+ babl_format ("RaGaBaA float"),
+ "linear",
+ conv_yaF_linear_rgbaF_linear,
+ NULL);
+
+ babl_conversion_new (babl_format ("Y'A float"),
+ babl_format ("R'G'B'A float"),
+ "linear",
+ conv_yaF_linear_rgbaF_linear,
+ NULL);
+
return 0;
}
diff --git a/tools/babl-benchmark.c b/tools/babl-benchmark.c
index d3d95b0f9..1fd9e78bd 100644
--- a/tools/babl-benchmark.c
+++ b/tools/babl-benchmark.c
@@ -25,7 +25,7 @@
#define random rand
#endif
-int ITERATIONS = 2;
+int ITERATIONS = 1;
#define N_PIXELS (512*1024) // a too small batch makes the test set live
// in l2 cache skewing results
@@ -80,12 +80,20 @@ test (void)
babl_format_with_space("RGBA float", babl_space("ProPhoto")),
babl_format_with_space("R'G'B' u16", babl_space("ProPhoto")),
#endif
- //babl_format("R'G'B'A u8"),
- //babl_format("R'G'B'A u16"),
- babl_format_with_space("R'G'B'A u8", babl_space("ProPhoto")),
- babl_format_with_space("R'G'B'A half", babl_space("ProPhoto")),
+ //babl_format("R'G'B'A u8"),
+ babl_format("R'G'B'A u16"),
+ //babl_format_with_space("R'G'B'A u8", babl_space("ProPhoto")),
+ //babl_format_with_space("Y'A u8", babl_space("ProPhoto")),
+ babl_format_with_space("Y'A u16", babl_space("ProPhoto")),
+ babl_format_with_space("Y' u16", babl_space("ProPhoto")),
+ //babl_format_with_space("Y' u8", babl_space("ProPhoto")),
+ babl_format_with_space("Y float", babl_space("ProPhoto")),
+ babl_format_with_space("YaA float", babl_space("ProPhoto")),
+ babl_format_with_space("YA float", babl_space("ProPhoto")),
+ //babl_format_with_space("YA u16", babl_space("ProPhoto")),
+ //babl_format_with_space("R'G'B'A half", babl_space("ProPhoto")),
babl_format_with_space("R'G'B'A float", babl_space("ProPhoto")),
- babl_format_with_space("R'G'B'A double", babl_space("ProPhoto")),
+ babl_format_with_space("RaGaBaA float", babl_space("ProPhoto")),
babl_format_with_space("cairo-RGB24", babl_space("Adobe")),
babl_format_with_space("cairo-ARGB32", babl_space("Adobe")),
@@ -93,7 +101,7 @@ test (void)
int n_formats = sizeof (formats) / sizeof (formats[0]);
const Babl *fishes[50 * 50];
double mbps[50 * 50] = {0,};
- int n;
+ long n;
double max = 0.0;
assert (n_formats < 50);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]