[gegl] shadows-highlights-correction: Simplify code
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] shadows-highlights-correction: Simplify code
- Date: Sun, 24 Dec 2017 13:00:46 +0000 (UTC)
commit 442b2e505e85c6f7185dd1f3feed4f62486605ab
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Dec 24 14:00:23 2017 +0100
shadows-highlights-correction: Simplify code
Fallout from 9384338e84d741248541610a6b178dc250a357bb
opencl/shadows-highlights-correction.cl.h | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/opencl/shadows-highlights-correction.cl.h b/opencl/shadows-highlights-correction.cl.h
index 08ae4b2..5aaff3b 100644
--- a/opencl/shadows-highlights-correction.cl.h
+++ b/opencl/shadows-highlights-correction.cl.h
@@ -9,10 +9,6 @@ static const char* shadows_highlights_correction_cl_source =
" /* a contains underlying image; b contains mask */ \n"
" \n"
" const float3 scale = (float3)(100.0f, 128.0f, 128.0f); \n"
-" const float lmax = 1.0f; \n"
-" const float halfmax = 0.5f; \n"
-" const float doublemax = 2.0f; \n"
-" \n"
" float3 a = in_a / scale; \n"
" float3 b = in_b / scale; \n"
" \n"
@@ -22,7 +18,7 @@ static const char* shadows_highlights_correction_cl_source =
" while(opacity2 > 0.0f) \n"
" { \n"
" float la = a.x; \n"
-" float lb = (b.x - halfmax) * sign(opacity)*sign(lmax - la) + halfmax; \n"
+" float lb = (b.x - 0.5f) * sign(opacity)*sign(1.0f - la) + 0.5f; \n"
" float lref = copysign(fabs(la) > low_approximation ? 1.0f/fabs(la) : 1.0f/low_approximation, la);\n"
" float href = copysign(fabs(1.0f - la) > low_approximation ? 1.0f/fabs(1.0f - la) :
1.0f/low_approximation, 1.0f - la);\n"
" \n"
@@ -30,7 +26,7 @@ static const char* shadows_highlights_correction_cl_source =
" float optrans = chunk * transform; \n"
" opacity2 -= 1.0f; \n"
" \n"
-" a.x = la * (1.0f - optrans) + (la > halfmax ? lmax - (lmax - doublemax * (la - halfmax)) * (lmax-lb) :
doublemax * la * lb) * optrans;\n"
+" a.x = la * (1.0f - optrans) + (la > 0.5f ? 1.0f - (1.0f - 2.0f * (la - 0.5f)) * (1.0f-lb) : 2.0f * la *
lb) * optrans;\n"
" a.y = a.y * (1.0f - optrans) + (a.y + b.y) * (a.x*lref * ccorrect + (1.0f - a.x)*href * (1.0f -
ccorrect)) * optrans;\n"
" a.z = a.z * (1.0f - optrans) + (a.z + b.z) * (a.x*lref * ccorrect + (1.0f - a.x)*href * (1.0f -
ccorrect)) * optrans;\n"
" } \n"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]