(wrong string) ée

From: <git_AT_suckless.org>
Date: Wed, 3 May 2017 22:29:48 +0200 (CEST)

commit 06b8e2576f952e8f8b097ee906f662d2ac38e2e8
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed May 3 20:20:12 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Wed May 3 20:20:12 2017 +0200

    Add constants D65_XYZ_X and D65_XYZ_Z
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/src/blind-gauss-blur.c b/src/blind-gauss-blur.c
index 2dc6d08..031860d 100644
--- a/src/blind-gauss-blur.c
+++ b/src/blind-gauss-blur.c
_AT_@ -31,15 +31,12 @@ process_xyza(char *restrict output, char *restrict cbuf, char *restrict sbuf,
         pixel_t *img = (pixel_t *)output;
         pixel_t c, k;
         size_t x1, y1, i1, x2, y2, i2;
- double d, m, X, Z;
+ double d, m;
         int i, blurred, blur[3] = {0, 0, 0};
         size_t start, end, x2start, x2end, y2start, y2end;
         int is_master;
         pid_t *children;
 
- X = D65_XYY_X / D65_XYY_Y;
- Z = 1 / D65_XYY_Y - 1 - X;
-
         y2start = x2start = 0;
         x2end = colour->width;
         y2end = colour->height;
_AT_@ -65,8 +62,8 @@ process_xyza(char *restrict output, char *restrict cbuf, char *restrict sbuf,
                         i1 = start * colour->width;
                         for (y1 = start; y1 < end; y1++) {
                                 for (x1 = 0; x1 < colour->width; x1++, i1++) {
- clr[i1][0] = clr[i1][0] / X - clr[i1][1];
- clr[i1][2] = clr[i1][2] / Z - clr[i1][1];
+ clr[i1][0] = clr[i1][0] / D65_XYZ_X - clr[i1][1];
+ clr[i1][2] = clr[i1][2] / D65_XYZ_Z - clr[i1][1];
                                         /*
                                          * Explaination:
                                          * Y is the luma and ((X / Xn - Y / Yn), (Z / Zn - Y / Yn))
_AT_@ -260,8 +257,8 @@ process_xyza(char *restrict output, char *restrict cbuf, char *restrict sbuf,
                 i1 = start * colour->width;
                 for (y1 = start; y1 < end; y1++) {
                         for (x1 = 0; x1 < colour->width; x1++, i1++) {
- img[i1][0] = (img[i1][0] + img[i1][1]) * X;
- img[i1][2] = (img[i1][2] + img[i1][1]) * Z;
+ img[i1][0] = (img[i1][0] + img[i1][1]) * D65_XYZ_X;
+ img[i1][2] = (img[i1][2] + img[i1][1]) * D65_XYZ_Z;
                         }
                 }
         }
diff --git a/src/blind-invert-luma.c b/src/blind-invert-luma.c
index b876967..9a8ac51 100644
--- a/src/blind-invert-luma.c
+++ b/src/blind-invert-luma.c
_AT_@ -13,17 +13,15 @@ static void
 process_xyza(struct stream *colour, struct stream *mask, size_t n)
 {
         size_t i;
- double w, y, yo, X, Z;
- X = D65_XYY_X / D65_XYY_Y;
- Z = 1 / D65_XYY_Y - 1 - X;
+ double w, y, yo;
         for (i = 0; i < n; i += colour->pixel_size) {
                 w = ((double *)(mask->buf + i))[1];
                 w *= ((double *)(mask->buf + i))[3];
                 yo = ((double *)(colour->buf + i))[1];
                 y = (1 - yo) * w + yo * (1 - w);
- ((double *)(colour->buf + i))[0] += (y - yo) * X;
+ ((double *)(colour->buf + i))[0] += (y - yo) * D65_XYZ_X;
                 ((double *)(colour->buf + i))[1] = y;
- ((double *)(colour->buf + i))[2] += (y - yo) * Z;
+ ((double *)(colour->buf + i))[2] += (y - yo) * D65_XYZ_Z;
                 /*
                  * Explaination:
                  * Y is the luma and ((X / Xn - Y / Yn), (Z / Zn - Y / Yn))
_AT_@ -37,17 +35,15 @@ static void
 process_xyza_i(struct stream *colour, struct stream *mask, size_t n)
 {
         size_t i;
- double w, y, yo, X, Z;
- X = D65_XYY_X / D65_XYY_Y;
- Z = 1 / D65_XYY_Y - 1 - X;
+ double w, y, yo;
         for (i = 0; i < n; i += colour->pixel_size) {
                 w = 1 - ((double *)(mask->buf + i))[1];
                 w *= ((double *)(mask->buf + i))[3];
                 yo = ((double *)(colour->buf + i))[1];
                 y = (1 - yo) * w + yo * (1 - w);
- ((double *)(colour->buf + i))[0] += (y - yo) * X;
+ ((double *)(colour->buf + i))[0] += (y - yo) * D65_XYZ_X;
                 ((double *)(colour->buf + i))[1] = y;
- ((double *)(colour->buf + i))[2] += (y - yo) * Z;
+ ((double *)(colour->buf + i))[2] += (y - yo) * D65_XYZ_Z;
         }
 }
 
diff --git a/src/blind-set-saturation.c b/src/blind-set-saturation.c
index 94e994c..ce0dd40 100644
--- a/src/blind-set-saturation.c
+++ b/src/blind-set-saturation.c
_AT_@ -13,17 +13,15 @@ static void
 process_xyza(struct stream *colour, struct stream *satur, size_t n)
 {
         size_t i;
- double s, *x, y, *z, X, Z;
- X = D65_XYY_X / D65_XYY_Y;
- Z = 1 / D65_XYY_Y - 1 - X;
+ double s, *x, y, *z;
         for (i = 0; i < n; i += colour->pixel_size) {
                 s = ((double *)(satur->buf + i))[1];
                 s *= ((double *)(satur->buf + i))[3];
                 x = ((double *)(colour->buf + i)) + 0;
                 y = ((double *)(colour->buf + i))[1];
                 z = ((double *)(colour->buf + i)) + 2;
- *x = ((*x / X - y) * s + y) * X;
- *z = ((*z / Z - y) * s + y) * Z;
+ *x = ((*x / D65_XYZ_X - y) * s + y) * D65_XYZ_X;
+ *z = ((*z / D65_XYZ_Z - y) * s + y) * D65_XYZ_Z;
                 /*
                  * Explaination:
                  * Y is the luma and ((X / Xn - Y / Yn), (Z / Zn - Y / Yn))
diff --git a/src/blind-single-colour.c b/src/blind-single-colour.c
index 955511a..2a6511d 100644
--- a/src/blind-single-colour.c
+++ b/src/blind-single-colour.c
_AT_@ -47,11 +47,9 @@ main(int argc, char *argv[])
                 usage();
 
         if (argc < 3) {
- X = D65_XYY_X / D65_XYY_Y;
- Z = 1 / D65_XYY_Y - 1 - X;
                 Y = etolf_arg("the Y value", argv[0]);
- X *= Y;
- Z *= Y;
+ X = Y * D65_XYZ_X;
+ Z = Y * D65_XYZ_Z;
         } else {
                 X = etolf_arg("the X value", argv[0]);
                 Y = etolf_arg("the Y value", argv[1]);
diff --git a/src/util/colour.h b/src/util/colour.h
index 84c543c..ae50d32 100644
--- a/src/util/colour.h
+++ b/src/util/colour.h
_AT_@ -4,6 +4,9 @@
 #define D65_XYY_X 0.312726871026564878786047074755
 #define D65_XYY_Y 0.329023206641284038376227272238
 
+#define D65_XYZ_X (D65_XYY_X / D65_XYY_Y)
+#define D65_XYZ_Z (1 / D65_XYY_Y - 1 - D65_XYZ_X)
+
 static inline double
 srgb_encode(double t)
 {
Received on Wed May 03 2017 - 22:29:48 CEST

This archive was generated by hypermail 2.3.0 : Wed May 03 2017 - 22:36:18 CEST