From f0b73149bd5e9f5b8540e5f36556046984f40334 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 11 Jan 2018 13:30:57 +0100 Subject: [PATCH] Speedup for Colour Toning Methods 'RGB sliders' and 'RGB curves' in 'Black-and-White' mode --- rtengine/improcfun.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index ceaed824d..49f85ba9c 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -4869,31 +4869,31 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer for (int i = 0; i < tH; i++) { for (int j = 0; j < tW; j++) { - float r = tmpImage->r (i, j); - float g = tmpImage->g (i, j); - float b = tmpImage->b (i, j); + float r = tmpImage->r(i, j); + float g = tmpImage->g(i, j); + float b = tmpImage->b(i, j); // Luminance = (0.299f*r + 0.587f*g + 0.114f*b) - float h, s, l; - Color::rgb2hsl (r, g, b, h, s, l); + float s, l; + Color::rgb2slfloat(r, g, b, s, l); - float l_ = Color::gamma_srgb (l * 65535.f) / 65535.f; + float l_ = Color::gammatab_srgb1[l * 65535.f]; - // get the opacity and tweak it to preserve saturated colors + // get the opacity and tweak it to preserve saturated colours float opacity = ctOpacityCurve.lutOpacityCurve[l_ * 500.f] / 4.f; float r2, g2, b2; - ctColorCurve.getVal (l_, r2, g2, b2); // get the color from the color curve + ctColorCurve.getVal(l_, r2, g2, b2); // get the colour from the colour curve float h2, s2, l2; - Color::rgb2hsl (r2, g2, b2, h2, s2, l2); // transform this new color to hsl + Color::rgb2hslfloat(r2, g2, b2, h2, s2, l2); // transform this new colour to hsl - Color::hsl2rgb (h2, s2, l, r2, g2, b2); + Color::hsl2rgbfloat(h2, s2, l, r2, g2, b2); - tmpImage->r (i, j) = r + (r2 - r) * opacity; - tmpImage->g (i, j) = g + (g2 - g) * opacity; - tmpImage->b (i, j) = b + (b2 - b) * opacity; + tmpImage->r(i, j) = intp(opacity, r2, r); + tmpImage->g(i, j) = intp(opacity, g2, g); + tmpImage->b(i, j) = intp(opacity, b2, b); } } }