GraphicsMagick: Colorspace: primary_info x, z are float so use fl...

GraphicsMagick Commits <[email protected]> Sat, 21 Oct 2023 17:52:37 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.10857.1697928765.7975.graphicsmagick-commit@lists.sourceforge.net>
changeset 8e342d89838c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=8e342d89838c
summary: Colorspace: primary_info x,z are float so use floating point math to compute them.

diffstat:

 magick/colorspace.c |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (76 lines):

diff -r 113711150b67 -r 8e342d89838c magick/colorspace.c
--- a/magick/colorspace.c	Sat Oct 21 17:38:15 2023 -0500
+++ b/magick/colorspace.c	Sat Oct 21 17:52:35 2023 -0500
@@ -1,5 +1,5 @@
 /*
-% Copyright (C) 2003 - 2021 GraphicsMagick Group
+% Copyright (C) 2003 - 2023 GraphicsMagick Group
 % Copyright (C) 2003 ImageMagick Studio
 % Copyright 1991-1999 E. I. du Pont de Nemours and Company
 %
@@ -634,8 +634,8 @@
             I and Q, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)
@@ -738,8 +738,8 @@
             Cb and Cr, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)
@@ -771,8 +771,8 @@
             Cb and Cr, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)
@@ -847,8 +847,8 @@
             I and Q, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)
@@ -880,8 +880,8 @@
             Pb and Pr, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)
@@ -914,8 +914,8 @@
             U and V, normally -0.5 through 0.5, are normalized to the range 0
             through MaxRGB.  Note that U = 0.493*(B-Y), V = 0.877*(R-Y).
           */
-          xform.primary_info.y=((MaxMap+1)/2);
-          xform.primary_info.z=((MaxMap+1)/2);
+          xform.primary_info.y=(((float) MaxMap+1)/2);
+          xform.primary_info.z=(((float) MaxMap+1)/2);
 #if MaxMap > 255
 #  if defined(HAVE_OPENMP)
 #    pragma omp parallel for schedule(static,64)