From 686d45b21b3faaf266358337657a6c3e1eb5a139 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 5 Aug 2016 23:28:03 +0200 Subject: Fix bugs in cie functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libclut.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libclut.h b/src/libclut.h index 0b5f081..973ac0a 100644 --- a/src/libclut.h +++ b/src/libclut.h @@ -786,12 +786,12 @@ static inline int libclut_0__(double x) { return libclut_eq__(x, 0); } size_t sn__ = (sclut)->channel##_size; \ double dm__ = (double)(dmax); \ double sm__ = (double)(smax); \ - double smdm__ = sm__ / dm__; \ + double dmsm__ = dm__ / sm__; \ double x__, y__; \ if (dn__ == sn__) \ for (di__ = 0; di__ < dn__; di__++) \ { \ - y__ = (double)((sclut)->channel[si__]) * smdm__; \ + y__ = (double)((sclut)->channel[di__]) * dmsm__; \ (dclut)->channel[di__] = (dtype)y__; \ } \ else \ @@ -803,7 +803,7 @@ static inline int libclut_0__(double x) { return libclut_eq__(x, 0); } x__ -= (double)si__; \ y__ = (double)((sclut)->channel[si__]) * (1 - x__); \ y__ += (double)((sclut)->channel[sj__]) * (x__); \ - y__ *= smdm__; \ + y__ *= dmsm__; \ (dclut)->channel[di__] = (dtype)y__; \ } \ } \ @@ -1007,7 +1007,7 @@ static inline int libclut_0__(double x) { return libclut_eq__(x, 0); } } \ if (btest) \ { \ - libclut_model_ciexyy_to_srgb(x__, y__, nexpr, &r__, &g__, &b__); \ + libclut_model_ciexyy_to_srgb(x__, y__, bexpr, &r__, &g__, &b__); \ bs__[i__] = (type)(b__ * m__); \ } \ } \ @@ -1016,17 +1016,17 @@ static inline int libclut_0__(double x) { return libclut_eq__(x, 0); } { \ if (rtest) \ for (i__ = 0; i__ < rn__; i__++) \ - libclut_cie___(clut, max, type, rexpr, i__, \ + libclut_cie___(clut, max, type, r, rexpr, i__, \ libclut_i__(i__, rn__, gn__), \ libclut_i__(i__, rn__, bn__)); \ if (gtest) \ for (i__ = 0; i__ < rn__; i__++) \ - libclut_cie___(clut, max, type, gexpr, \ + libclut_cie___(clut, max, type, g, gexpr, \ libclut_i__(i__, gn__, rn__), i__, \ libclut_i__(i__, gn__, bn__)); \ if (btest) \ for (i__ = 0; i__ < rn__; i__++) \ - libclut_cie___(clut, max, type, bexpr, i__, \ + libclut_cie___(clut, max, type, b, bexpr, \ libclut_i__(i__, bn__, rn__), \ libclut_i__(i__, bn__, gn__), i__); \ } \ -- cgit v1.2.3-70-g09d2