[gegl] negative-darkroom: speed up operation
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] negative-darkroom: speed up operation
- Date: Sat, 24 Jul 2021 11:52:38 +0000 (UTC)
commit 680b8718829dd89f610b13a3d4fd6cbe7a74d64c
Author: Richard Kreckel <kreckel ginac de>
Date: Sun Jul 11 16:53:40 2021 +0200
negative-darkroom: speed up operation
When getting the CIEXYZ tranmittance back, use these two
mathematical identities:
* pow(10, a) + pow(10, b) == pow(10, a*b)
* 1/pow(10, x) == pow(10, -x)
While at it, fix the reference hash, which was broken in
commit 3d5e9bc8be06. (This patch does not alter the hash.)
operations/common/negative-darkroom.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/operations/common/negative-darkroom.c b/operations/common/negative-darkroom.c
index 3677f2642..b8bbe328f 100644
--- a/operations/common/negative-darkroom.c
+++ b/operations/common/negative-darkroom.c
@@ -347,16 +347,16 @@ process (GeglOperation *operation,
b = (b - bMid) * o->contrast + bMid;
// 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;
+ // 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;
/*printf("XYZ output %f %f %f\n", out[0], out[1], out[2]);*/
in += 3;
@@ -385,7 +385,7 @@ gegl_op_class_init (GeglOpClass *klass)
"name", "gegl:negative-darkroom",
"title", _("Negative Darkroom"),
"categories", "color",
- "reference-hash", "d492ac8ef38c336aa79e63b7f39f6139",
+ "reference-hash", "2c048959d4827d580d1ab1b6635bc40b",
"description", _("Simulate a negative film enlargement in "
"an analog darkroom."),
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]