Unstable output w/ same PP3 and RAW CA auto-correction when image height % 2 == 1, fixes #3258

This commit is contained in:
heckflosse
2016-04-21 20:51:47 +02:00
parent f7af57d11e
commit 58fb7af2bb

View File

@@ -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;