aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-06-11 10:30:22 +0200
committerMattias Andrée <maandree@kth.se>2017-06-11 10:30:22 +0200
commit039dcdbc9b0e001b7cb5a4d8dc1be46930574dda (patch)
treeb5d36117618fc2ed4d499fba6207bec37cde47d1
parentm (diff)
downloadlibcolour-039dcdbc9b0e001b7cb5a4d8dc1be46930574dda.tar.gz
libcolour-039dcdbc9b0e001b7cb5a4d8dc1be46930574dda.tar.bz2
libcolour-039dcdbc9b0e001b7cb5a4d8dc1be46930574dda.tar.xz
Make conversion macros not require restrict
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--common.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/common.h b/common.h
index 5c781b6..12c86a2 100644
--- a/common.h
+++ b/common.h
@@ -318,9 +318,10 @@
#define YUV_TO_YDBDR(FROM_Y, FROM_U, FROM_V, TO_Y, TO_DB, TO_DR)\
do {\
+ TYPE U__ = (FROM_U), V__ = (FROM_V);\
(TO_Y) = (FROM_Y);\
- (TO_DB) = (FROM_U) * D(3.069);\
- (TO_DR) = (FROM_V) * D(-2.169);\
+ (TO_DB) = U__ * D(3.069);\
+ (TO_DR) = V__ * D(-2.169);\
} while (0)
#define CIEXYZ_TO_YDBDR(FROM_X, FROM_Y, FROM_Z, TO_Y, TO_DB, TO_DR)\
@@ -337,9 +338,10 @@
#define YDBDR_TO_YUV(FROM_Y, FROM_DB, FROM_DR, TO_Y, TO_U, TO_V)\
do {\
+ TYPE DB__ = (FROM_DB), DR__ = (FROM_DR);\
(TO_Y) = (FROM_Y);\
- (TO_U) = (FROM_DB) / D(3.069);\
- (TO_V) = (FROM_DR) / D(-2.169);\
+ (TO_U) = DB__ / D(3.069);\
+ (TO_V) = DR__ / D(-2.169);\
} while (0)
#define SRGB_TO_YUV(FROM_R, FROM_G, FROM_B, TO_Y, TO_U, TO_V)\
@@ -439,11 +441,12 @@
#define CIE1960UCS_TO_CIEUVW(FROM_U, FROM_V, FROM_Y, TO_U, TO_V, TO_W, TO_U0, TO_V0)\
do {\
+ TYPE U__ = (FROM_U), V__ = (FROM_V), u0__ = (TO_U0), v0__ = (TO_V0);\
TYPE Y__ = 25 * xcbrt((FROM_Y)) - 17;\
TYPE w__ = Y__ * 13;\
- to->U = w__ * ((FROM_U) - (TO_U0));\
- to->V = w__ * ((FROM_V) - (TO_V0));\
- to->W = Y__;\
+ (to->U) = w__ * (U__ - u0__);\
+ (to->V) = w__ * (V__ - v0__);\
+ (to->W) = Y__;\
} while (0)