From 3f08841819f1e4d4262bd34dd7a085b2ea2e47d7 Mon Sep 17 00:00:00 2001 From: torger Date: Wed, 8 Jul 2015 10:38:18 +0200 Subject: [PATCH] clipping fix for issue 2739 --- rtengine/improccoordinator.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 73078f7c1..38178e1ec 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -994,6 +994,17 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring& fname, bool delete im; im = tmpim; } + + // image may contain out of range samples, clip them to avoid wrap-arounds +#pragma omp parallel for + for(int i=0;iheight;i++) { + for(int j=0;jwidth;j++) { + im->r(i,j) = CLIP(im->r(i,j)); + im->g(i,j) = CLIP(im->g(i,j)); + im->b(i,j) = CLIP(im->b(i,j)); + } + } + Image16* im16 = im->to16(); delete im;