From cfc1e66024684da5b48a43ee11f20ae52802a4ea Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 19 Aug 2020 14:00:09 +0200 Subject: [PATCH] CH vectorscope: speedup by avoiding conversions --- rtengine/improccoordinator.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index f25395c2d..accff6377 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -42,7 +42,8 @@ #ifdef _OPENMP #include #endif - +#define BENCHMARK +#include "StopWatch.h" namespace { @@ -1850,7 +1851,7 @@ void ImProcCoordinator::updateVectorscope() if (!workimg) { return; } - +BENCHFUN int x1, y1, x2, y2; params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); @@ -1891,10 +1892,6 @@ void ImProcCoordinator::updateVectorscope() } } } else if (hListener->vectorscopeType() == 1) { // CH - const std::unique_ptr a(new float[vectorscopeScale]); - const std::unique_ptr b(new float[vectorscopeScale]); - const std::unique_ptr L(new float[vectorscopeScale]); - ipf.rgb2lab(*workimg, x1, y1, x2 - x1, y2 - y1, L.get(), a.get(), b.get(), params->icm); #ifdef _OPENMP #pragma omp parallel #endif @@ -1904,9 +1901,11 @@ void ImProcCoordinator::updateVectorscope() #pragma omp for nowait #endif for (int i = y1; i < y2; ++i) { - for (int j = x1, ofs_lab = (i - y1) * (x2 - x1); j < x2; ++j, ++ofs_lab) { - const int col = (size / 96000.f) * a[ofs_lab] + size / 2; - const int row = (size / 96000.f) * b[ofs_lab] + size / 2; + const float* const a = nprevl->a[i] + x1; + const float* const b = nprevl->b[i] + x1; + for (int j = x1; j < x2; ++j) { + const int col = (size / 96000.f) * a[j] + size / 2; + const int row = (size / 96000.f) * b[j] + size / 2; if (col >= 0 && col < size && row >= 0 && row < size) { vectorscopeThr[row][col]++; }