[babl] extension: add some Y' u8 fast paths



commit 0664bd4164536be723f0864b18fb56e0f6b699d0
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Apr 4 23:49:55 2018 +0200

    extension: add some Y' u8 fast paths
    
    GIMP makes use of "Y' u8" to "R'G'B' u8" and we had no paths covering it,
    making it go through floating point. This commit adds code paths for expanding
    single grayscale u8 to R'G'B and R'G'B'A as well as R'aG'aB'aA u8.

 extensions/gggl.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/extensions/gggl.c b/extensions/gggl.c
index 625d730..8195ba1 100644
--- a/extensions/gggl.c
+++ b/extensions/gggl.c
@@ -485,6 +485,37 @@ conv_gF_rgbF (const Babl *conversion,unsigned char *src, unsigned char *dst, lon
 }
 
 static void
+conv_g8_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+{
+  long n = samples;
+
+  while (n--)
+    {
+      dst[0]=*src;
+      dst[1]=*src;
+      dst[2]=*src;
+      dst += 3;
+      src += 1;
+    }
+}
+#define conv_g8_rgbA8  conv_g8_rgba8
+static void
+conv_g8_rgba8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+{
+  long n = samples;
+
+  while (n--)
+    {
+      dst[0]=*src;
+      dst[1]=*src;
+      dst[2]=*src;
+      dst[3]=255;
+      dst += 4;
+      src += 1;
+    }
+}
+
+static void
 conv_gaF_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -1067,6 +1098,9 @@ init (void)
   o (ga8, gaF);
   o (gA8, gAF);
   o (g8, gF);
+  o (g8, rgb8);
+  o (g8, rgba8);
+  o (g8, rgbA8);
   o (gaF, ga16);
   o (gAF, gA16);
   o (gF, g16);


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