From 58fb7af2bbd79b8797f8b80c9062899dd38c5113 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 21 Apr 2016 20:51:47 +0200 Subject: [PATCH] Unstable output w/ same PP3 and RAW CA auto-correction when image height % 2 == 1, fixes #3258 --- rtengine/CA_correct_RT.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index 1796b7169..ab0b95a27 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -197,7 +197,7 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons // assign working space constexpr int buffersize = 3 * sizeof(float) * ts * ts + 6 * sizeof(float) * ts * tsh + 8 * 64 + 63; - char *buffer = (char *) calloc(buffersize, 1); + char *buffer = (char *) malloc(buffersize); char *data = (char*)( ( uintptr_t(buffer) + uintptr_t(63)) / 64 * 64); // shift the beginning of all arrays but the first by 64 bytes to avoid cache miss conflicts on CPUs which have <=4-way associative L1-Cache @@ -231,6 +231,7 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons #pragma omp for collapse(2) schedule(dynamic) nowait for (int top = -border ; top < height; top += ts - border2) for (int left = -border; left < width; left += ts - border2) { + memset(buffer, 0, buffersize); const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1; const int bottom = min(top + ts, height + border); @@ -730,6 +731,7 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons for (int top = -border; top < height; top += ts - border2) for (int left = -border; left < width; left += ts - border2) { + memset(buffer, 0, buffersize); float lblockshifts[2][2]; const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1;