From 33ea50e2dd5893b278f51b921e006783f19587dc Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 4 Jul 2021 14:27:44 +0200 Subject: [PATCH] Abstrcat profile - fixed crash when BxBy aligned with RxRY GxGy --- rtengine/iplab2rgb.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 5e14d6cad..48074ea56 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -519,6 +519,14 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, greyy = 0.55f * (gregraphy + 1.f) - 0.1f; greyy = rtengine::LIM(greyy, 0.5f, 1.f); } + //fixed crash when there is no space or too small..just a line...Possible if bx, by aligned with Gx,Gy Rx,Ry + float ac = (greyy - redyy) / (grexx - redxx); + float bc = greyy - ac * grexx; + float yc = ac * bluxx + bc; + if ((bluyy < yc + 0.0004f) && (bluyy > yc - 0.0004f)) {//under 0.0004 in some case crash because space too small + return; + } + switch (ColorManagementParams::Primaries(prim)) { case ColorManagementParams::Primaries::DEFAULT: {