From 0b57619f6248eda1fcca00585c38da950c8f062e Mon Sep 17 00:00:00 2001 From: Ingo Date: Wed, 11 Jun 2014 17:35:34 +0200 Subject: [PATCH] Shadows from S/H broken on small JPEG files, Issue 2408 --- rtengine/dcrop.cc | 3 ++- rtengine/shmap.cc | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 378f01782..4843d2b16 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -190,7 +190,8 @@ void Crop::update (int todo) { double shradius = params.sh.radius; if (!params.sh.hq) shradius *= radius / 1800.0; cshmap->update (baseCrop, shradius, parent->ipf.lumimul, params.sh.hq, skip); - cshmap->forceStat (parent->shmap->max_f, parent->shmap->min_f, parent->shmap->avg); + if(parent->shmap->min_f < 65535.f) // don't call forceStat with wrong values + cshmap->forceStat (parent->shmap->max_f, parent->shmap->min_f, parent->shmap->avg); } // shadows & highlights & tone curve & convert to cielab diff --git a/rtengine/shmap.cc b/rtengine/shmap.cc index 1faec01f2..17c00eaae 100644 --- a/rtengine/shmap.cc +++ b/rtengine/shmap.cc @@ -140,8 +140,8 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int #ifdef _OPENMP #pragma omp for reduction(+:_avg) nowait #endif - for (int i=32; i