[gimp] app: small optimization in gimp_operation_normal_mode_process()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: small optimization in gimp_operation_normal_mode_process()
- Date: Sun, 28 Apr 2013 21:36:45 +0000 (UTC)
commit 77d1b49edc48a2c9043bc1d812d21dd51f36bcc8
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 28 23:32:49 2013 +0200
app: small optimization in gimp_operation_normal_mode_process()
Move some calculations out of the R,G,B loop, including a floating
point division, now there is only one division left per pixel.
app/operations/gimpoperationnormalmode.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/app/operations/gimpoperationnormalmode.c b/app/operations/gimpoperationnormalmode.c
index 0e263be..9aed268 100644
--- a/app/operations/gimpoperationnormalmode.c
+++ b/app/operations/gimpoperationnormalmode.c
@@ -176,11 +176,13 @@ gimp_operation_normal_mode_process (GeglOperation *operation,
if (out[ALPHA])
{
- gint b;
+ gfloat in_weight = in[ALPHA] * (1.0f - aux_alpha);
+ gfloat recip_out_alpha = 1.0f / out[ALPHA];
+ gint b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = (aux[b] * aux_alpha + in[b] * in[ALPHA] * (1.0f - aux_alpha)) / out[ALPHA];
+ out[b] = (aux[b] * aux_alpha + in[b] * in_weight) * recip_out_alpha;
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]