From 46fbc8acc8f761dd0c7c47dfbc79b6979014a2ba Mon Sep 17 00:00:00 2001 From: JonnyRobbie Date: Wed, 5 Feb 2025 21:03:31 +0100 Subject: [PATCH 1/2] Add more options, more papers and some optimizations --- operations/common/negative-darkroom.c | 109 ++++++++--- .../negative-darkroom-curve-enum.c | 4 + .../negative-darkroom-curve-enum.h | 178 ++++++++++++------ 3 files changed, 209 insertions(+), 82 deletions(-) diff --git a/operations/common/negative-darkroom.c b/operations/common/negative-darkroom.c index b53e9b3c3..3ce4c2986 100644 --- a/operations/common/negative-darkroom.c +++ b/operations/common/negative-darkroom.c @@ -1,5 +1,5 @@ /* This file is an image processing operation for GEGL -* +* * GEGL is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -28,8 +28,8 @@ property_enum (curve, _("Characteristic curve"), property_double (exposure, _("Exposure"), 0.0) description(_("Base enlargement exposure")) - value_range (-10, 10) - ui_range (-5, 5) + value_range (-20, 10) + ui_range (-15, 5) property_double (expC, _("Cyan filter"), 60) description(_("Cyan filter compensation for the negative image")) @@ -48,17 +48,42 @@ property_double (expY, _("Yellow filter"), 60) property_boolean (clip, _("Clip base + fog"), TRUE) description (_("Clip base + fog to have a pure white output value")) +property_double (add_fog, _("Add base and fog"), 0.0) + description (_("Artificially reintroduce base and fog.")) + ui_meta("visible", "clip") + value_range (-2, 4) + ui_range (0, 2) +property_double (boost_c, _("Cyan density boost"), 1.0) + description(_("Boost paper density to take advantage of increased dynamic range of a monitor compared to a photographic paper")) + value_range (0.25, 10) + ui_range (1, 4) + ui_gamma (2) property_double (boost, _("Density boost"), 1.0) description(_("Boost paper density to take advantage of increased dynamic range of a monitor compared to a photographic paper")) + value_range (0.25, 10) + ui_range (1, 4) + ui_gamma (2) +property_double (boost_y, _("Yellow density boost"), 1.0) + description(_("Boost paper density to take advantage of increased dynamic range of a monitor compared to a photographic paper")) + value_range (0.25, 10) + ui_range (1, 4) + ui_gamma (2) +property_double (contrast_r, _("Contrast boost R"), 1.0) + description(_("Increase red contrast for papers with fixed contrast (usually color papers)")) value_range (0.25, 4) - ui_range (1, 2) + ui_range (0.75, 1.5) ui_gamma (2) property_double (contrast, _("Contrast boost"), 1.0) description(_("Increase contrast for papers with fixed contrast (usually color papers)")) value_range (0.25, 4) ui_range (0.75, 1.5) ui_gamma (2) +property_double (contrast_b, _("Contrast boost B"), 1.0) + description(_("Increase blue contrast for papers with fixed contrast (usually color papers)")) + value_range (0.25, 4) + ui_range (0.75, 1.5) + ui_gamma (2) property_double (dodge, _("Dodge/burn multiplier"), 1.0) description(_("The f-stop of dodge/burn for pure white/black auxiliary input")) @@ -152,15 +177,28 @@ curve_lerp (gfloat * xs, gfloat * ys, guint n, gfloat in) { if (in <= xs[0]) return(ys[0]); - for (guint i = 1; i <= n; i++) + + guint min = 0; + guint max = n - 1; + + if (in >= xs[max]) + return(ys[max]); + + // Binary tree search + guint split; + while (max - min > 1) { - if (in <= xs[i]) + split = min + ((max - min) / 2); + if (in < xs[split]) { - return(ys[i-1] + (in - xs[i-1]) * \ - ((ys[i] - ys[i-1]) / (xs[i] - xs[i-1]))); + max = split; } - } - return(ys[n-1]); + else + { + min = split; + } + } + return(ys[min] + (in - xs[min]) * ((ys[max] - ys[min]) / (xs[max] - xs[min]))); } static gfloat @@ -226,15 +264,16 @@ process (GeglOperation *operation, gfloat exp = pow(2, o->exposure); + // Calculate base+fog if (o->clip) { Dfogc = array_min(curves[o->curve].ry, - curves[o->curve].rn) * o->boost; + curves[o->curve].rn) * o->boost * o->boost_c; Dfogm = array_min(curves[o->curve].gy, curves[o->curve].gn) * o->boost; Dfogy = array_min(curves[o->curve].by, - curves[o->curve].bn) * o->boost; + curves[o->curve].bn) * o->boost * o->boost_y; } // Calculate exposure for mid density @@ -263,7 +302,7 @@ process (GeglOperation *operation, for (glong i = 0; i < n_pixels; i++) { - /*printf("Input XYZ intensity %f %f %f\n", in[0], in[1], in[2]);*/ + /*printf("==\nInput XYZ intensity %f %f %f\n", in[0], in[1], in[2]);*/ // Calculate exposure compensation from global+filter+dodge if (aux) @@ -281,16 +320,19 @@ process (GeglOperation *operation, x = 0.41847*in[0] - 0.15866*in[1] - 0.082835*in[2]; y = -0.091169*in[0] + 0.25243*in[1] + 0.015708*in[2]; z = 0.00092090*in[0] - 0.0025498*in[1] + 0.17860*in[2]; + /*printf("Input CIERGB intensity %f %f %f\n", x, y, z);*/ // Apply preflash x += o->flashC / 100; y += o->flashM / 100; z += o->flashY / 100; + /*printf("Preflashed intensity %f %f %f\n", x, y, z);*/ // Apply color filters and exposure x *= rcomp * exp; y *= gcomp * exp; z *= bcomp * exp; + /*printf("After color balance and exposure %f %f %f\n", x, y, z);*/ // Simulate emulsion spectral sensitivity with // sensitivity matrix @@ -308,6 +350,7 @@ process (GeglOperation *operation, r *= 5000; g *= 5000; b *= 5000; + /*printf("Linear RGB intensity %f %f %f\n", r, g, b);*/ // Logarithmize the input r = log10(r); @@ -316,9 +359,10 @@ process (GeglOperation *operation, /*printf("Logarithmic RGB intensity %f %f %f\n", r, g, b);*/ // Adjust contrast - r = (r - rMid) * o->contrast + rMid; + r = (r - rMid) * o->contrast * o->contrast_r + rMid; g = (g - gMid) * o->contrast + gMid; - b = (b - bMid) * o->contrast + bMid; + b = (b - bMid) * o->contrast * o->contrast_b + bMid; + /*printf("Logarithmic RGB intensity after contrast %f %f %f\n", r, g, b);*/ // Apply the DH curve r = curve_lerp(curves[o->curve].rx, @@ -336,9 +380,16 @@ process (GeglOperation *operation, /*printf("Raw RGB density %f %f %f\n", r, g, b);*/ // Apply density boost - r *= o->boost; + r *= o->boost * o->boost_c; g *= o->boost; - b *= o->boost; + b *= o->boost * o->boost_y; + /*printf("Raw RGB density after density boost %f %f %f\n", r, g, b);*/ + + // Apply artificial fog + r += o->add_fog; + g += o->add_fog; + b += o->add_fog; + /*printf("Raw RGB density after fogging %f %f %f\n", r, g, b);*/ // Compensate for fog r -= Dfogc; @@ -347,16 +398,16 @@ process (GeglOperation *operation, /*printf("Adjusted RGB density %f %f %f\n", r, g, b);*/ // Simulate dye density with exponentiation to get - // the CIEXYZ transmittance back - out[0] = pow(10, -(r * curves[o->curve].cdens.X + - g * curves[o->curve].mdens.X + - b * curves[o->curve].ydens.X)) * o->illumX; - out[1] = pow(10, -(r * curves[o->curve].cdens.Y + - g * curves[o->curve].mdens.Y + - b * curves[o->curve].ydens.Y)); - out[2] = pow(10, -(r * curves[o->curve].cdens.Z + - g * curves[o->curve].mdens.Z + - b * curves[o->curve].ydens.Z)) * o->illumZ; + // the CIEXYZ tramsmittance back + out[0] = (1 / pow(10, r * curves[o->curve].cdens.X)) * + (1 / pow(10, g * curves[o->curve].mdens.X)) * + (1 / pow(10, b * curves[o->curve].ydens.X)) * o->illumX; + out[1] = (1 / pow(10, r * curves[o->curve].cdens.Y)) * + (1 / pow(10, g * curves[o->curve].mdens.Y)) * + (1 / pow(10, b * curves[o->curve].ydens.Y)); + out[2] = (1 / pow(10, r * curves[o->curve].cdens.Z)) * + (1 / pow(10, g * curves[o->curve].mdens.Z)) * + (1 / pow(10, b * curves[o->curve].ydens.Z)) * o->illumZ; /*printf("XYZ output %f %f %f\n", out[0], out[1], out[2]);*/ in += 3; @@ -385,8 +436,8 @@ gegl_op_class_init (GeglOpClass *klass) "name", "gegl:negative-darkroom", "title", _("Negative Darkroom"), "categories", "color", - "reference-hash", "81752f5612f3f639f68522fae6c506a3", - "description", _("Simulate a negative film enlargement in " + "reference-hash", "unstable", + "description", _("Simulate a film enlargement in " "an analog darkroom."), NULL); } diff --git a/operations/common/negative-darkroom/negative-darkroom-curve-enum.c b/operations/common/negative-darkroom/negative-darkroom-curve-enum.c index 6e39a7bfa..26356bbfc 100644 --- a/operations/common/negative-darkroom/negative-darkroom-curve-enum.c +++ b/operations/common/negative-darkroom/negative-darkroom-curve-enum.c @@ -1,4 +1,8 @@ enum_start(neg_curve) + enum_value (NEG_KODAK_ULTRA, "kodakultra", N_("Kodak Professional Ultra Endura")) + enum_value (NEG_KODAK_PORTRA, "kodakportra", N_("Kodak Professional Portra Endura")) + enum_value (NEG_KODAK_SUPRA, "kodaksupra", N_("Kodak Professional Supra Endura")) + enum_value (NEG_KODAK_EKTACHROME, "kodakektachrome3", N_("Kodak Ektachrome Radiance III")) enum_value (NEG_FUJI, "fujicrystal", N_("Fujicolor Crystal Archive Digital Pearl Paper")) enum_value (NEG_ILFOBROM1, "ilfobrom1", N_("Ilford Ilfobrom Galerie FB 1")) enum_value (NEG_ILFOBROM2, "ilfobrom2", N_("Ilford Ilfobrom Galerie FB 2")) diff --git a/operations/common/negative-darkroom/negative-darkroom-curve-enum.h b/operations/common/negative-darkroom/negative-darkroom-curve-enum.h index 118811b56..6b39f8431 100644 --- a/operations/common/negative-darkroom/negative-darkroom-curve-enum.h +++ b/operations/common/negative-darkroom/negative-darkroom-curve-enum.h @@ -1,4 +1,76 @@ -static HDCurve curves[11] = { +static HDCurve curves[15] = { +{ +// Kodak Professional Ultra Endura +.rx = (gfloat[]){-0.00590551181102006, 0.91830708661417, 1.11318897637795, 1.31988188976378, 1.44094488188976, 1.60334645669291, 1.71259842519685, 1.875, 1.93996062992126, 2.04625984251969, 2.12007874015748, 2.17027559055118, 2.23523622047244, 2.33562992125984, 2.51574803149606, 2.66043307086614, 2.97637795275591, 3.12992125984252}, +.ry = (gfloat[]){0.209677419354839, 0.209677419354839, 0.220430107526882, 0.282258064516129, 0.365591397849462, 0.604838709677419, 0.884408602150538, 1.45430107526882, 1.70161290322581, 2.05376344086022, 2.26075268817204, 2.36827956989247, 2.46774193548387, 2.57795698924731, 2.6505376344086, 2.68279569892473, 2.72043010752688, 2.7258064516129}, +.rn = 18, +.gx = (gfloat[]){0.00295275590550981, 0.87106299212598, 1.1751968503937, 1.28149606299213, 1.41437007874016, 1.46456692913386, 1.59153543307087, 1.6742125984252, 1.78937007874016, 1.875, 1.9251968503937, 1.99015748031496, 2.06397637795276, 2.13188976377953, 2.18208661417323, 2.24409448818898, 2.32677165354331, 2.37696850393701, 2.5246062992126, 2.65452755905512, 2.86417322834646, 2.99704724409449, 3.13582677165354}, +.gy = (gfloat[]){0.206989247311828, 0.209677419354839, 0.225806451612903, 0.244623655913979, 0.311827956989247, 0.384408602150538, 0.516129032258065, 0.685483870967742, 1.00537634408602, 1.32258064516129, 1.54301075268817, 1.79032258064516, 2.02688172043011, 2.21505376344086, 2.31451612903226, 2.41129032258065, 2.5, 2.52956989247312, 2.5752688172043, 2.59408602150538, 2.60483870967742, 2.62096774193548, 2.62365591397849}, +.gn = 23, +.bx = (gfloat[]){0.00295275590550981, 0.91535433070866, 1.0511811023622, 1.25787401574803, 1.34055118110236, 1.4498031496063, 1.5738188976378, 1.6505905511811, 1.73031496062992, 1.86318897637795, 1.93700787401575, 1.99015748031496, 2.06692913385827, 2.13779527559055, 2.1998031496063, 2.26771653543307, 2.34744094488189, 2.50984251968504, 2.67814960629921, 2.87007874015748, 2.99704724409449, 3.13582677165354}, +.by = (gfloat[]){0.158602150537634, 0.161290322580645, 0.166666666666667, 0.190860215053763, 0.217741935483871, 0.28494623655914, 0.435483870967742, 0.583333333333333, 0.817204301075269, 1.26881720430108, 1.58333333333333, 1.77956989247312, 2.03225806451613, 2.22311827956989, 2.34139784946237, 2.42204301075269, 2.48655913978495, 2.5241935483871, 2.53494623655914, 2.54301075268817, 2.5510752688172, 2.54838709677419}, +.bn = 22, +.rsens = {1.98384528338158, -1.139908628642506, 0.9117718451678841}, +.gsens = {-1.9446903829191977, 11.824244131400773, 0.3858842109802745}, +.bsens = {0.24055760815458516, 0.081015700654826, 40.45514992137221}, +.cdens = {0.3888451909495336, 0.2476526736862776, 0.05309234005533177}, +.mdens = {0.4070944939119089, 0.6760446088670498, 0.0928393075030548}, +.ydens = {0.11141890339242015, 0.14986675822686338, 0.9066923809231089} +}, +{ +// Kodak Professional Portra Endura +.rx = (gfloat[]){0.00268817204301008, 0.67741935483871, 0.85752688172043, 1.01344086021505, 1.16935483870968, 1.27688172043011, 1.38440860215054, 1.55376344086021, 1.68279569892473, 1.76881720430108, 1.8252688172043, 1.90860215053763, 2.00537634408602, 2.14784946236559, 2.31182795698925, 2.58333333333333, 2.71236559139785, 2.86559139784946}, +.ry = (gfloat[]){0.0860986547085202, 0.0968609865470852, 0.126457399103139, 0.196412556053812, 0.347085201793722, 0.519282511210762, 0.747982062780269, 1.22421524663677, 1.64125560538117, 1.91031390134529, 2.05560538116592, 2.22511210762332, 2.36502242152466, 2.47533632286996, 2.54260089686099, 2.6152466367713, 2.62600896860987, 2.65560538116592}, +.rn = 18, +.gx = (gfloat[]){0.00537634408602017, 0.62903225806452, 0.89784946236559, 1.01344086021505, 1.20698924731183, 1.36021505376344, 1.52150537634409, 1.66129032258065, 1.75537634408602, 1.83870967741935, 1.91935483870968, 2.0241935483871, 2.19354838709677, 2.33870967741936, 2.53763440860215, 2.63440860215054, 2.76612903225806, 2.86827956989247}, +.gy = (gfloat[]){0.0914798206278027, 0.0968609865470852, 0.139910313901345, 0.196412556053812, 0.373991031390135, 0.648430493273543, 1.07085201793722, 1.53094170403587, 1.81883408071749, 2.03139013452915, 2.17937219730942, 2.31121076233184, 2.44843049327354, 2.51838565022422, 2.60179372197309, 2.61793721973094, 2.63677130044843, 2.65829596412556}, +.gn = 18, +.bx = (gfloat[]){0.00537634408602017, 0.62096774193548, 0.86290322580645, 1.04301075268817, 1.19086021505376, 1.31451612903226, 1.46236559139785, 1.5994623655914, 1.72849462365591, 1.81720430107527, 1.89516129032258, 1.98118279569892, 2.04838709677419, 2.17204301075269, 2.31182795698925, 2.60483870967742, 2.86290322580645}, +.by = (gfloat[]){0.0887892376681614, 0.0968609865470852, 0.12914798206278, 0.217937219730942, 0.357847533632287, 0.565022421524664, 0.917488789237668, 1.34798206278027, 1.74349775784753, 1.98295964125561, 2.1390134529148, 2.25470852017937, 2.30582959641256, 2.35964125560538, 2.38385650224215, 2.41076233183857, 2.42152466367713}, +.bn = 17, +.rsens = {1.1848251054964796, -0.4589958478327778, 0.6535833046332541}, +.gsens = {-2.2207455147925383, 13.948225333331083, 1.3298860895588045}, +.bsens = {0.0657966103494427, 1.370877982371645, 52.94538495523703}, +.cdens = {0.40861364833304104, 0.27064909842548784, 0.04938624183122874}, +.mdens = {0.2318172654878267, 0.48743437273066076, 0.11956262911764708}, +.ydens = {0.074587906956869, 0.057357751364889506, 0.8119041376149216} +}, +{ +// Kodak Professional Supra Endura +.rx = (gfloat[]){0.0, 0.63978494623656, 0.88172043010753, 1.03763440860215, 1.16666666666667, 1.26612903225806, 1.34139784946237, 1.45161290322581, 1.5510752688172, 1.62096774193548, 1.71774193548387, 1.79301075268817, 1.84408602150538, 1.89784946236559, 1.97849462365591, 2.01612903225806, 2.07258064516129, 2.13440860215054, 2.19086021505376, 2.28763440860215, 2.34677419354839, 2.5, 2.65860215053763, 2.76612903225806, 2.87096774193548}, +.ry = (gfloat[]){0.0913978494623656, 0.0887096774193548, 0.0994623655913978, 0.115591397849462, 0.147849462365591, 0.196236559139785, 0.244623655913979, 0.349462365591398, 0.497311827956989, 0.626344086021505, 0.873655913978495, 1.11559139784946, 1.30913978494624, 1.56451612903226, 1.89247311827957, 2.01881720430108, 2.20967741935484, 2.36021505376344, 2.45430107526882, 2.54569892473118, 2.58064516129032, 2.63172043010753, 2.65591397849462, 2.6505376344086, 2.62634408602151}, +.rn = 25, +.gx = (gfloat[]){0.00268817204301008, 0.60215053763441, 0.87903225806452, 1.01881720430108, 1.16666666666667, 1.2741935483871, 1.34677419354839, 1.46505376344086, 1.5752688172043, 1.65860215053763, 1.74731182795699, 1.8252688172043, 1.90591397849462, 1.94623655913978, 1.99193548387097, 2.06182795698925, 2.13978494623656, 2.2258064516129, 2.3010752688172, 2.43279569892473, 2.51344086021505, 2.63440860215054, 2.74731182795699, 2.87096774193548}, +.gy = (gfloat[]){0.0887096774193548, 0.0860215053763441, 0.0860215053763441, 0.0967741935483871, 0.120967741935484, 0.169354838709677, 0.21505376344086, 0.338709677419355, 0.5, 0.67741935483871, 0.905913978494624, 1.15860215053763, 1.48387096774194, 1.63172043010753, 1.79301075268817, 1.99731182795699, 2.17741935483871, 2.31451612903226, 2.40591397849462, 2.49731182795699, 2.53763440860215, 2.57795698924731, 2.59139784946237, 2.57795698924731}, +.gn = 24, +.bx = (gfloat[]){0.0, 0.63978494623656, 0.88172043010753, 1.03763440860215, 1.16666666666667, 1.26612903225806, 1.34139784946237, 1.45161290322581, 1.5510752688172, 1.62096774193548, 1.71774193548387, 1.79301075268817, 1.84408602150538, 1.89784946236559, 1.97849462365591, 2.01612903225806, 2.08870967741936, 2.13440860215054, 2.19354838709677, 2.31182795698925, 2.43548387096774, 2.70161290322581, 2.76075268817204, 2.87365591397849}, +.by = (gfloat[]){0.0913978494623656, 0.0887096774193548, 0.0994623655913978, 0.115591397849462, 0.147849462365591, 0.196236559139785, 0.244623655913979, 0.349462365591398, 0.497311827956989, 0.626344086021505, 0.873655913978495, 1.11559139784946, 1.30913978494624, 1.56451612903226, 1.89247311827957, 2.01881720430108, 2.21236559139785, 2.30376344086022, 2.38172043010753, 2.46505376344086, 2.49462365591398, 2.51881720430108, 2.51075268817204, 2.4758064516129}, +.bn = 24, +.rsens = {1.1848251054964796, -0.4589958478327778, 0.6535833046332541}, +.gsens = {-2.2207455147925383, 13.948225333331083, 1.3298860895588045}, +.bsens = {0.0657966103494427, 1.370877982371645, 52.94538495523703}, +.cdens = {0.40861364833304104, 0.27064909842548784, 0.04938624183122874}, +.mdens = {0.2318172654878267, 0.48743437273066076, 0.11956262911764708}, +.ydens = {0.074587906956869, 0.057357751364889506, 0.8119041376149216} +}, +{ +// Kodak Ektachrome Radiance III +.rx = (gfloat[]){0.003584229390681, 0.347670250896057, 0.476702508960574, 0.709677419354839, 0.810035842293907, 0.967741935483871, 1.23655913978495, 1.39068100358423, 1.60931899641577, 1.81003584229391, 1.98566308243728, 2.2258064516129, 2.40143369175627, 2.5089605734767, 2.62007168458781, 2.74910394265233, 2.91039426523298, 3.20071684587814, 3.48028673835125, 3.79928315412186}, +.ry = (gfloat[]){2.51971326164875, 2.51612903225806, 2.49462365591398, 2.41218637992832, 2.35483870967742, 2.21505376344086, 1.91397849462366, 1.72043010752688, 1.39784946236559, 1.12903225806452, 0.899641577060932, 0.594982078853047, 0.379928315412186, 0.258064516129032, 0.164874551971326, 0.114695340501792, 0.0896057347670251, 0.0860215053763441, 0.0716845878136201, 0.0716845878136201}, +.rn = 20, +.gx = (gfloat[]){0.0, 0.25089605734767, 0.401433691756272, 0.67741935483871, 0.781362007168459, 0.924731182795699, 1.06451612903226, 1.25089605734767, 1.40501792114695, 1.584229390681, 1.7741935483871, 1.98924731182796, 2.15770609318996, 2.36559139784946, 2.48745519713262, 2.584229390681, 2.70609318996416, 2.84587813620072, 3.01075268817204, 3.22222222222222, 3.53405017921147, 3.79928315412186}, +.gy = (gfloat[]){2.415770609319, 2.415770609319, 2.40860215053763, 2.36200716845878, 2.3405017921147, 2.26523297491039, 2.14336917562724, 1.93906810035842, 1.68817204301075, 1.40860215053763, 1.16487455197133, 0.896057347670251, 0.684587813620072, 0.426523297491039, 0.283154121863799, 0.189964157706093, 0.129032258064516, 0.0967741935483871, 0.0860215053763441, 0.0860215053763441, 0.0752688172043011, 0.0752688172043011}, +.gn = 22, +.bx = (gfloat[]){0.003584229390681, 0.333333333333333, 0.462365591397849, 0.67741935483871, 0.799283154121864, 0.874551971326165, 0.985663082437276, 1.12186379928315, 1.25448028673835, 1.44444444444444, 1.59139784946237, 1.73118279569892, 1.88530465949821, 2.09318996415771, 2.2831541218638, 2.46594982078853, 2.57706093189964, 2.68458781362007, 2.78494623655914, 2.92831541218638, 3.19354838709677, 3.50537634408602, 3.80286738351255}, +.by = (gfloat[]){2.44802867383513, 2.45519713261649, 2.44802867383513, 2.41218637992832, 2.38351254480287, 2.34767025089606, 2.26164874551971, 2.11827956989247, 1.93189964157706, 1.63082437275986, 1.39784946236559, 1.21146953405018, 1.02867383512545, 0.763440860215054, 0.544802867383513, 0.340501792114695, 0.236559139784946, 0.172043010752688, 0.132616487455197, 0.111111111111111, 0.100358422939068, 0.100358422939068, 0.100358422939068}, +.bn = 23, +.rsens = {5.641292445332529, -3.636150769844754, 1.4513761034917236}, +.gsens = {-1.5907276239778056, 9.346415798969861, -1.2139757091123264}, +.bsens = {0.6377849153014424, 1.129481391779387, 30.254901902853426}, +.cdens = {0.5762585626789296, 0.4514793325415063, 0.22367527926318234}, +.mdens = {0.3081645478063752, 0.5661388809064667, 0.2862818135066987}, +.ydens = {0.1848100792933141, 0.18693913572693638, 0.879194188906693} +}, { // Fujicolor Crystal Archive Digital Pearl Paper .rx = (gfloat[]){0.944085027726432, 1.0854898336414, 1.26016635859519, 1.38909426987061, 1.49722735674677, 1.59288354898336, 1.67606284658041, 1.73844731977819, 1.83410351201479, 1.94639556377079, 2.10027726432532, 2.15850277264325, 2.22088724584103, 2.28327171903882, 2.33733826247689, 2.39556377079482, 2.46210720887246, 2.55360443622921, 2.64510166358595, 2.76571164510166, 2.85720887245841, 2.95702402957486, 3.04436229205176}, @@ -10,12 +82,12 @@ static HDCurve curves[11] = { .bx = (gfloat[]){0.944085027726432, 1.1728280961183, 1.29343807763401, 1.4681146025878, 1.54297597042514, 1.6677449168207, 1.7634011090573, 1.83826247689464, 1.93391866913124, 2.04205175600739, 2.13770794824399, 2.20841035120148, 2.28327171903882, 2.33733826247689, 2.43715341959335, 2.49537892791128, 2.62014787430684, 2.73243992606285, 2.81977818853974, 2.91127541589649, 3.05683918669131}, .by = (gfloat[]){0.062370062370063, 0.070686070686071, 0.087318087318087, 0.128898128898129, 0.17047817047817, 0.291060291060291, 0.436590436590437, 0.602910602910603, 0.860706860706861, 1.21829521829522, 1.57172557172557, 1.8045738045738, 1.995841995842, 2.1039501039501, 2.24116424116424, 2.30769230769231, 2.39085239085239, 2.43243243243243, 2.45322245322245, 2.46569646569647, 2.47817047817048}, .bn = 21, -.rsens = {13.216626122512007, -8.227588994124007, 5.5928592740343674}, -.gsens = {-1.892225727743786, 18.471992221986618, 2.3648557587980648}, -.bsens = {-0.48215460646731667, 3.7273454493862825, 19.69174710002292}, -.cdens = {0.4481979852989705, 0.314585869218717, 0.059960861345768876}, -.mdens = {0.32037627279379055, 0.5719703189837888, 0.2318783856658509}, -.ydens = {0.12402572420852252, 0.11220266078991072, 0.82348502517513} +.rsens = {13.226907659760457, -8.266874344973635, 5.621470541183597}, +.gsens = {-1.8995070640221714, 18.4987666781453, 2.352293791237075}, +.bsens = {-0.4700713410033488, 3.7449251599513627, 19.623269987613565}, +.cdens = {0.44777697060987937, 0.3142843437299804, 0.05986584701380561}, +.mdens = {0.3191199696246844, 0.5697655559607199, 0.23072883778490316}, +.ydens = {0.1240676832679609, 0.11225436806714818, 0.8238989279506523} }, { // Ilford Ilfobrom Galerie FB 1 @@ -31,9 +103,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Ilford Ilfobrom Galerie FB 2 @@ -49,9 +121,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Ilford Ilfobrom Galerie FB 3 @@ -67,9 +139,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Ilford Ilfobrom Galerie FB 4 @@ -85,27 +157,27 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Ilford Multigrade IV RC Deluxe -.rx = (gfloat[]){1.4175998847065818, 1.6645998847065817, 1.7905998847065816, 1.8605998847065819, 1.912599884706582, 1.9455998847065819, 1.9995998847065817, 2.033599884706582, 2.0635998847065817, 2.090599884706582, 2.1085998847065817, 2.142599884706582, 2.198599884706582, 2.255599884706582, 2.284599884706582, 2.316599884706582, 2.356599884706582, 2.4065998847065817, 2.477599884706582, 2.601599884706582, 2.7455998847065817}, -.ry = (gfloat[]){0.010324304382967808, 0.011248199014068795, 0.012257403333089143, 0.01819062738271929, 0.026078923102844962, 0.04853211805309718, 0.07812503814734445, 0.10921133018526209, 0.1471749703315005, 0.18443346486701004, 0.22997172105182173, 0.27226289725573105, 0.3341898165415062, 0.38372051942076135, 0.42042941659598687, 0.4351705729738252, 0.4501109559351687, 0.4642143696466637, 0.4764098662262221, 0.47918347130497196, 0.4791834713049721}, +.rx = (gfloat[]){1.4171742311305109, 1.6641742311305108, 1.7901742311305107, 1.860174231130511, 1.912174231130511, 1.945174231130511, 1.9991742311305107, 2.033174231130511, 2.063174231130511, 2.090174231130511, 2.1081742311305107, 2.142174231130511, 2.198174231130511, 2.255174231130511, 2.284174231130511, 2.316174231130511, 2.356174231130511, 2.4061742311305108, 2.477174231130511, 2.601174231130511, 2.7451742311305107}, +.ry = (gfloat[]){0.010765255369527481, 0.011683473765473034, 0.012372137562432198, 0.0180379715781075, 0.025592416932341242, 0.04786066008927139, 0.0780998908825413, 0.10857764691528017, 0.14634075849900172, 0.18349884183678086, 0.2306363350122063, 0.2734880155160542, 0.3362379799047848, 0.3866560865974206, 0.42425263751426806, 0.43948960510469365, 0.45472465796221284, 0.4691998689777924, 0.4817632709171204, 0.48468954579308027, 0.48468954579308016}, .rn = 21, -.gx = (gfloat[]){1.7592759955350934, 2.006275995535093, 2.132275995535093, 2.2022759955350932, 2.2542759955350933, 2.287275995535093, 2.341275995535093, 2.3752759955350933, 2.405275995535093, 2.432275995535093, 2.450275995535093, 2.4842759955350933, 2.5402759955350933, 2.5972759955350933, 2.626275995535093, 2.658275995535093, 2.6982759955350932, 2.748275995535093, 2.8192759955350932, 2.9432759955350933, 3.087275995535093}, -.gy = (gfloat[]){0.014813541483019594, 0.01613916604193243, 0.017587194837878586, 0.026100316625748653, 0.037418618716220056, 0.06963496206334203, 0.11209554179431286, 0.15669884479423668, 0.21116991977343746, 0.2646292361519006, 0.3299685386400133, 0.39064885857477044, 0.47950297927163954, 0.5505707330464511, 0.6032414749124313, 0.6243924138435842, 0.6458292075064267, 0.6660650990801078, 0.6835634687315634, 0.6875430989678973, 0.6875430989678976}, +.gx = (gfloat[]){1.7583674350203617, 2.0053674350203616, 2.1313674350203615, 2.201367435020362, 2.253367435020362, 2.2863674350203618, 2.3403674350203616, 2.374367435020362, 2.4043674350203617, 2.431367435020362, 2.4493674350203616, 2.483367435020362, 2.539367435020362, 2.596367435020362, 2.6253674350203617, 2.6573674350203618, 2.697367435020362, 2.7473674350203616, 2.818367435020362, 2.942367435020362, 3.0863674350203616}, +.gy = (gfloat[]){0.015183528913891853, 0.016478602285172093, 0.017449907313632277, 0.025441111576359757, 0.036096050593329744, 0.06750362080219734, 0.11015362949433814, 0.15314005889791152, 0.20640189774225357, 0.25881039279207757, 0.3252940446879143, 0.3857329016964302, 0.4742366915218819, 0.5453473855531858, 0.5983743039414319, 0.6198648241407139, 0.6413526437628662, 0.6617687674353123, 0.6794884378058448, 0.6836157137193266, 0.6836157137193265}, .gn = 21, -.bx = (gfloat[]){2.1261790772490836, 2.3731790772490835, 2.4991790772490834, 2.5691790772490837, 2.6211790772490837, 2.6541790772490836, 2.7081790772490835, 2.7421790772490837, 2.7721790772490835, 2.7991790772490837, 2.8171790772490835, 2.8511790772490837, 2.9071790772490838, 2.9641790772490837, 2.9931790772490836, 3.0251790772490836, 3.0651790772490837, 3.1151790772490835, 3.1861790772490837, 3.310179077249084, 3.4541790772490835}, -.by = (gfloat[]){0.018360273195730175, 0.020003285373777404, 0.02179800841953461, 0.032349384128914034, 0.04637757034833112, 0.08630731070776017, 0.13893401343130068, 0.19421646087638, 0.2617292713025447, 0.32798808285619363, 0.40897124582740674, 0.4841799494911138, 0.5943079652954991, 0.682391113826059, 0.7476725464388939, 0.7738875482713264, 0.8004568455957672, 0.8255377148853861, 0.8472256311509777, 0.852158084233911, 0.8521580842339112}, +.bx = (gfloat[]){2.1258333957567794, 2.3728333957567793, 2.498833395756779, 2.5688333957567795, 2.6208333957567795, 2.6538333957567795, 2.7078333957567793, 2.7418333957567795, 2.7718333957567793, 2.7988333957567795, 2.8168333957567793, 2.8508333957567795, 2.9068333957567796, 2.9638333957567795, 2.9928333957567794, 3.0248333957567795, 3.0648333957567795, 3.1148333957567793, 3.1858333957567795, 3.3098333957567796, 3.4538333957567793}, +.by = (gfloat[]){0.01889238445027323, 0.020503803255499213, 0.0217123673594187, 0.031655569892130336, 0.0449131732690792, 0.08399261879191737, 0.13706067468254798, 0.19054732821628673, 0.2568193484878828, 0.32202958008533616, 0.4047530838503338, 0.4799552406621983, 0.5900777050886867, 0.6785584909312969, 0.7445382071148927, 0.7712781811975798, 0.798014795037621, 0.823417931527932, 0.8454659565207204, 0.8506013953065295, 0.8506013953065292}, .bn = 21, -.rsens = {0.0, 0.0, 1.0}, -.gsens = {0.0, 0.5178010948888863, 1}, +.rsens = {0.0, 0.0, 0.0}, +.gsens = {0.0, 0.5185369484782029, 1.0}, .bsens = {0.0, 1.0, 1.0}, -.cdens = {1, 1, 1}, -.mdens = {1, 1, 1}, -.ydens = {1, 1, 1} +.cdens = {1.0, 1.0, 1.0}, +.mdens = {1.0, 1.0, 1.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Foma Fomabrom C @@ -121,9 +193,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Foma Fomabrom N @@ -139,9 +211,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Foma Fomabrom Sp @@ -157,9 +229,9 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Foma Fomabrom S @@ -175,26 +247,26 @@ static HDCurve curves[11] = { .rsens = {0, 0, 0}, .gsens = {0, 0, 0}, .bsens = {0, 0, 1}, -.cdens = {0, 0, 0}, -.mdens = {0, 0, 0}, -.ydens = {1, 1, 1} +.cdens = {0.0, 0.0, 0.0}, +.mdens = {0.0, 0.0, 0.0}, +.ydens = {1.0, 1.0, 1.0} }, { // Foma Fomabrom Variant III -.rx = (gfloat[]){-0.15477518799190898, 0.08958571426373108, 0.23369598995295304, 0.325174686694808, 0.4742974937123521, 0.6296859648902939, 0.835199749351454, 0.896603258123384, 0.988081954865234, 1.083320050103334, 1.138457894714854, 1.213645864639674}, -.ry = (gfloat[]){0.026687751404829638, 0.035859636141161756, 0.05696854127040171, 0.10672477707954037, 0.18695111054247987, 0.30305251781200454, 0.40607423350124205, 0.47801358379771275, 0.5180402202518342, 0.54844497502493, 0.5646113624653601, 0.5680413126990469}, +.rx = (gfloat[]){-0.15512384125735973, 0.08923706099828033, 0.2333473366875023, 0.32482603342935723, 0.47394884044690133, 0.6293373116248432, 0.8348510960860033, 0.8962546048579333, 0.9877333015997832, 1.0829713968378831, 1.1381092414494032, 1.2132972113742233}, +.ry = (gfloat[]){0.026681207566130023, 0.035854401267955714, 0.05701882954745202, 0.10683416911874348, 0.187256961790024, 0.3037462770213813, 0.40714361193006104, 0.4792985817735561, 0.5194223722334506, 0.5498971581934878, 0.5660932475364828, 0.5695731468401573}, .rn = 12, -.gx = (gfloat[]){0.08315254145874457, 0.3275134437143846, 0.4716237194036066, 0.5631024161454615, 0.7122252231630056, 0.8676136943409475, 1.0731274788021077, 1.1345309875740375, 1.2260096843158874, 1.3212477795539876, 1.3763856241655077, 1.4515735940903274}, -.gy = (gfloat[]){0.025405116424060247, 0.034136192940023694, 0.05423058696588138, 0.1015954977213603, 0.1779660885210264, 0.2884875679794168, 0.3865579764446976, 0.45503986321101203, 0.49314278704881664, 0.5220862646441495, 0.5374756823905344, 0.5407407864337239}, +.gx = (gfloat[]){0.08290892283012558, 0.32726982508576563, 0.4713801007749876, 0.5628587975168425, 0.7119816045343866, 0.8673700757123285, 1.0728838601734885, 1.1342873689454187, 1.2257660656872686, 1.3210041609253684, 1.3761420055368885, 1.4513299754617086}, +.gy = (gfloat[]){0.025253795016567198, 0.03393623387616534, 0.05396839066998776, 0.10111866942315266, 0.17723893930773585, 0.2874962161263229, 0.3853619178405832, 0.45365668348557425, 0.49163389936122137, 0.5204783208852869, 0.5358079389066698, 0.5391016677784037}, .gn = 12, -.bx = (gfloat[]){0.4376465286343034, 0.6820074308899434, 0.8261177065791654, 0.9175964033210203, 1.0667192103385645, 1.2221076815165064, 1.4276214659776665, 1.4890249747495965, 1.5805036714914464, 1.6757417667295464, 1.7308796113410665, 1.8060675812658864}, -.by = (gfloat[]){0.041941797737101716, 0.05635610071242231, 0.08953032419615994, 0.16772597083609284, 0.2938076552856473, 0.47626970189366724, 0.6381760347436221, 0.7512341052308589, 0.8141389586517978, 0.8619223052363505, 0.8873289924420565, 0.8927194158152141}, +.bx = (gfloat[]){0.43856572823455386, 0.6829266304901939, 0.8270369061794158, 0.9185156029212708, 1.067638409938815, 1.2230268811167568, 1.428540665577917, 1.489944174349847, 1.5814228710916969, 1.6766609663297969, 1.731798810941317, 1.8069867808661368}, +.by = (gfloat[]){0.04183342855514458, 0.05621606631232641, 0.08939974423043985, 0.16750514645935982, 0.29359993220249253, 0.4762433689393976, 0.6383599077794723, 0.7514915855105143, 0.8144016212502889, 0.8621829961386915, 0.8875768222885623, 0.8930329516087419}, .bn = 12, -.rsens = {0.0, 0.0, 1.0}, -.gsens = {0.0, 0.5983811484737084, 1}, +.rsens = {0.0, 0.0, 0.0}, +.gsens = {0.0, 0.5990619065596916, 1.0}, .bsens = {0.0, 1.0, 1.0}, -.cdens = {1, 1, 1}, -.mdens = {1, 1, 1}, -.ydens = {1, 1, 1} +.cdens = {1.0, 1.0, 1.0}, +.mdens = {1.0, 1.0, 1.0}, +.ydens = {1.0, 1.0, 1.0} } }; -- GitLab From 3913d98a12631f7acbaa476458cca60cfe64046f Mon Sep 17 00:00:00 2001 From: JonnyRobbie Date: Fri, 7 Feb 2025 22:20:26 +0100 Subject: [PATCH 2/2] Convert internal logic to single precision float --- operations/common/negative-darkroom.c | 94 +++++++++++++-------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/operations/common/negative-darkroom.c b/operations/common/negative-darkroom.c index 3ce4c2986..71e8479d8 100644 --- a/operations/common/negative-darkroom.c +++ b/operations/common/negative-darkroom.c @@ -124,7 +124,7 @@ property_double (illumZ, _("Z multiplier"), 0.829) #define GEGL_OP_NAME negative_darkroom #define GEGL_OP_C_SOURCE negative-darkroom.c -#define EPSILON 0.00001 +#define EPSILON 0.00001f #include "gegl-op.h" @@ -246,23 +246,23 @@ process (GeglOperation *operation, gfloat *aux = aux_buf; gfloat *out = out_buf; - gfloat Dfogc = 0; - gfloat Dfogm = 0; - gfloat Dfogy = 0; + gfloat Dfogc = 0.f; + gfloat Dfogm = 0.f; + gfloat Dfogy = 0.f; - gfloat rcomp = 0; - gfloat gcomp = 0; - gfloat bcomp = 0; + gfloat rcomp = 0.f; + gfloat gcomp = 0.f; + gfloat bcomp = 0.f; - gfloat r = 0; - gfloat g = 0; - gfloat b = 0; + gfloat r = 0.f; + gfloat g = 0.f; + gfloat b = 0.f; - gfloat x = 0; - gfloat y = 0; - gfloat z = 0; + gfloat x = 0.f; + gfloat y = 0.f; + gfloat z = 0.f; - gfloat exp = pow(2, o->exposure); + gfloat exp = powf(2.f, o->exposure); // Calculate base+fog @@ -283,21 +283,21 @@ process (GeglOperation *operation, gfloat rMid = curve_lerp(curves[o->curve].ry, curves[o->curve].rx, curves[o->curve].rn, - Dmaxc / 2); + Dmaxc / 2.f); gfloat gMid = curve_lerp(curves[o->curve].gy, curves[o->curve].gx, curves[o->curve].gn, - Dmaxm / 2); + Dmaxm / 2.f); gfloat bMid = curve_lerp(curves[o->curve].by, curves[o->curve].bx, curves[o->curve].bn, - Dmaxy / 2); + Dmaxy / 2.f); if (!aux) { - rcomp = pow(2, (-o->expC) / 30); - gcomp = pow(2, (-o->expM) / 30); - bcomp = pow(2, (-o->expY) / 30); + rcomp = powf(2.f, (-o->expC) / 30.f); + gcomp = powf(2.f, (-o->expM) / 30.f); + bcomp = powf(2.f, (-o->expY) / 30.f); } for (glong i = 0; i < n_pixels; i++) @@ -307,25 +307,25 @@ process (GeglOperation *operation, // Calculate exposure compensation from global+filter+dodge if (aux) { - rcomp = pow(2, ((-o->expC) / 30) - - (2 * o->dodge * (aux[0] - 0.5))); - gcomp = pow(2, ((-o->expM) / 30) - - (2 * o->dodge * (aux[1] - 0.5))); - bcomp = pow(2, ((-o->expY) / 30) - - (2 * o->dodge * (aux[2] - 0.5))); + rcomp = powf(2.f, ((-o->expC) / 30.f) - + (2.f * o->dodge * (aux[0] - 0.5f))); + gcomp = powf(2.f, ((-o->expM) / 30.f) - + (2.f * o->dodge * (aux[1] - 0.5f))); + bcomp = pow(2.f, ((-o->expY) / 30.f) - + (2.f * o->dodge * (aux[2] - 0.5f))); aux += 3; } // Convert to CIERGB primaries for color filter balance - x = 0.41847*in[0] - 0.15866*in[1] - 0.082835*in[2]; - y = -0.091169*in[0] + 0.25243*in[1] + 0.015708*in[2]; - z = 0.00092090*in[0] - 0.0025498*in[1] + 0.17860*in[2]; + x = 0.41847f*in[0] - 0.15866f*in[1] - 0.082835f*in[2]; + y = -0.091169f*in[0] + 0.25243f*in[1] + 0.015708f*in[2]; + z = 0.00092090f*in[0] - 0.0025498f*in[1] + 0.17860f*in[2]; /*printf("Input CIERGB intensity %f %f %f\n", x, y, z);*/ // Apply preflash - x += o->flashC / 100; - y += o->flashM / 100; - z += o->flashY / 100; + x += o->flashC / 100.f; + y += o->flashM / 100.f; + z += o->flashY / 100.f; /*printf("Preflashed intensity %f %f %f\n", x, y, z);*/ // Apply color filters and exposure @@ -347,15 +347,15 @@ process (GeglOperation *operation, z * curves[o->curve].bsens.Z); // Scale the emulsion response - r *= 5000; - g *= 5000; - b *= 5000; + r *= 5000.f; + g *= 5000.f; + b *= 5000.f; /*printf("Linear RGB intensity %f %f %f\n", r, g, b);*/ // Logarithmize the input - r = log10(r); - g = log10(g); - b = log10(b); + r = log10f(r); + g = log10f(g); + b = log10f(b); /*printf("Logarithmic RGB intensity %f %f %f\n", r, g, b);*/ // Adjust contrast @@ -399,15 +399,15 @@ process (GeglOperation *operation, // Simulate dye density with exponentiation to get // the CIEXYZ tramsmittance back - out[0] = (1 / pow(10, r * curves[o->curve].cdens.X)) * - (1 / pow(10, g * curves[o->curve].mdens.X)) * - (1 / pow(10, b * curves[o->curve].ydens.X)) * o->illumX; - out[1] = (1 / pow(10, r * curves[o->curve].cdens.Y)) * - (1 / pow(10, g * curves[o->curve].mdens.Y)) * - (1 / pow(10, b * curves[o->curve].ydens.Y)); - out[2] = (1 / pow(10, r * curves[o->curve].cdens.Z)) * - (1 / pow(10, g * curves[o->curve].mdens.Z)) * - (1 / pow(10, b * curves[o->curve].ydens.Z)) * o->illumZ; + out[0] = (1 / powf(10.f, r * curves[o->curve].cdens.X)) * + (1 / powf(10.f, g * curves[o->curve].mdens.X)) * + (1 / powf(10.f, b * curves[o->curve].ydens.X)) * o->illumX; + out[1] = (1 / powf(10.f, r * curves[o->curve].cdens.Y)) * + (1 / powf(10.f, g * curves[o->curve].mdens.Y)) * + (1 / powf(10.f, b * curves[o->curve].ydens.Y)); + out[2] = (1 / powf(10.f, r * curves[o->curve].cdens.Z)) * + (1 / powf(10.f, g * curves[o->curve].mdens.Z)) * + (1 / powf(10.f, b * curves[o->curve].ydens.Z)) * o->illumZ; /*printf("XYZ output %f %f %f\n", out[0], out[1], out[2]);*/ in += 3; -- GitLab