From 15517c0c5d906aad9e7e062c657c72a1a62f42a0 Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sat, 8 Jan 2011 16:57:36 -0600 Subject: [PATCH] Fixing bug in ComplexCurve. --- rtengine/curves.cc | 4 ++-- rtengine/dcrop.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index ef5d17175..b200d2288 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -24,8 +24,8 @@ #include #include -#undef CLIPD #define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) +#define CLIP(a) ((a)<65535 ? (a) : (65535)) namespace rtengine { @@ -537,7 +537,7 @@ double CurveFactory::centercontrast (double x, double b, double m) { double avg = 0; //double sqavg = 0; for (int i=0; i<=0xffff; i++) { - avg += dcurve[(int)shCurve[(int)hlCurve[i]*i]] * histogram[i]; + avg += dcurve[(int)shCurve[CLIP((int)hlCurve[i]*i)]] * histogram[i]; //sqavg += dcurve[i]*dcurve[i] * histogram[i]; sum += histogram[i]; } diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index b8e62a867..44ebd575c 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -21,7 +21,7 @@ #include #include #define CLIPTO(a,b,c) ((a)>b?((a) 0)) namespace rtengine {