[babl] Added direct code paths for RGB u8 and RGBA u8 to RaGaBaA float
- From: Øyvind Kolås <ok src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [babl] Added direct code paths for RGB u8 and RGBA u8 to RaGaBaA float
- Date: Thu, 12 Nov 2009 20:11:19 +0000 (UTC)
commit b6aa1794754ee32fb2e3412528a8f6eb96596042
Author: �yvind Kolås <pippin gimp org>
Date: Thu Nov 12 19:32:39 2009 +0000
Added direct code paths for RGB u8 and RGBA u8 to RaGaBaA float
extensions/gimp-8bit.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/extensions/gimp-8bit.c b/extensions/gimp-8bit.c
index cd6b89f..dd5e7cb 100644
--- a/extensions/gimp-8bit.c
+++ b/extensions/gimp-8bit.c
@@ -65,6 +65,28 @@ u8_linear_to_float_linear (unsigned char *src,
return samples;
}
+
+static INLINE long
+u8_linear_to_float_linear_premul (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *d = (float *) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ float alpha = lut_linear[src[3]];
+ d[0] = lut_linear[src[0]] * alpha;
+ d[1] = lut_linear[src[1]] * alpha;
+ d[2] = lut_linear[src[2]] * alpha;
+ d[3] = alpha;
+ src += 4;
+ d += 4;
+ }
+ return samples;
+}
+
static INLINE long
u8_gamma_2_2_to_float_linear (unsigned char *src,
unsigned char *dst,
@@ -90,6 +112,17 @@ conv_rgba8_linear_rgbaF_linear (unsigned char *src,
}
static INLINE long
+conv_rgba8_linear_ragabaaF_linear (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ u8_linear_to_float_linear_premul (src, dst, samples);
+
+ return samples;
+}
+
+
+static INLINE long
conv_rgba8_gamma_2_2_rgbaF_linear (unsigned char *src,
unsigned char *dst,
long samples)
@@ -147,6 +180,8 @@ conv_rgb8_linear_rgbaF_linear (unsigned char *src,
return samples;
}
+#define conv_rgb8_linear_ragabaaF_linear conv_rgb8_linear_rgbaF_linear
+
static INLINE long
conv_rgb8_gamma_2_2_rgbaF_linear (unsigned char *src,
unsigned char *dst,
@@ -354,6 +389,14 @@ int init (void);
int
init (void)
{
+ Babl *ragabaaF_linear = babl_format_new (
+ babl_model ("RaGaBaA"),
+ babl_type ("float"),
+ babl_component ("Ra"),
+ babl_component ("Ga"),
+ babl_component ("Ba"),
+ babl_component ("A"),
+ NULL);
Babl *rgbaF_linear = babl_format_new (
babl_model ("RGBA"),
babl_type ("float"),
@@ -438,12 +481,14 @@ init (void)
#define o(src, dst) \
babl_conversion_new (src, dst, "linear", conv_ ## src ## _ ## dst, NULL)
+ o (rgba8_linear, ragabaaF_linear);
o (rgba8_linear, rgbaF_linear);
o (rgba8_gamma_2_2, rgbaF_linear);
o (rgb8_linear, rgbF_linear);
o (rgb8_gamma_2_2, rgbF_linear);
o (rgb8_linear, rgbaF_linear);
+ o (rgb8_linear, ragabaaF_linear);
o (rgb8_gamma_2_2, rgbaF_linear);
o (ga8_linear, gaF_linear);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]