[babl] reorder loops of reference premul
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] reorder loops of reference premul
- Date: Sat, 31 Mar 2012 02:47:37 +0000 (UTC)
commit d36119a4f79dd174fd762bfa6761cb0743b6753f
Author: Ãyvind KolÃs <pippin gimp org>
Date: Sat Mar 31 03:44:45 2012 +0100
reorder loops of reference premul
babl/base/model-rgb.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/babl/base/model-rgb.c b/babl/base/model-rgb.c
index 8de970e..df7f7b0 100644
--- a/babl/base/model-rgb.c
+++ b/babl/base/model-rgb.c
@@ -285,16 +285,16 @@ premultiplied_to_non_premultiplied (int src_bands,
int band;
alpha = *(double *) src[src_bands - 1];
- for (band = 0; band < src_bands - 1; band++)
+ if (alpha > BABL_ALPHA_THRESHOLD)
{
- if (alpha > BABL_ALPHA_THRESHOLD)
- {
- *(double *) dst[band] = *(double *) src[band] / alpha;
- }
- else
- {
- *(double *) dst[band] = 0.00;
- }
+ double recip_alpha = 1.0 / alpha;
+ for (band = 0; band < src_bands - 1; band++)
+ *(double *) dst[band] = *(double *) src[band] * recip_alpha;
+ }
+ else
+ {
+ for (band = 0; band < src_bands - 1; band++)
+ *(double *) dst[band] = 0.0;
}
*(double *) dst[dst_bands - 1] = alpha;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]