reverted to original method for colour propagation of fully clipped highlights

The "new" one was producing artifacts in some cases -- needs further investigation
This commit is contained in:
Alberto Griggio 2018-04-03 10:38:59 +02:00
parent 65783e0216
commit acfdf220ec

View File

@ -415,7 +415,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
{ { 1.f, 0.8660254f, -0.5f }, { 1.f, -0.8660254f, -0.5f }, { 1.f, 0.f, 1.f } };
std::unique_ptr<PixelsMap> recovered_partial;
std::unique_ptr<PixelsMap> recovered_full;
if(settings->verbose)
for(int c = 0; c < 3; c++) {
@ -1109,16 +1108,11 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
//now correct clipped channels
if (pixel[0] > max_f[0] && pixel[1] > max_f[1] && pixel[2] > max_f[2]) {
//all channels clipped
// float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]);
// float factor = whitept / Y;
// red[i][j] = CLIP(clipfix[0] * factor);
// green[i][j] = CLIP(clipfix[1] * factor);
// blue[i][j] = CLIP(clipfix[2] * factor);
red[i][j] = green[i][j] = blue[i][j] = whitept;
if (!recovered_full) {
recovered_full.reset(new PixelsMap(width, height));
}
recovered_full->set(j, i);
float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]);
float factor = whitept / Y;
red[i][j] = CLIP(clipfix[0] * factor);
green[i][j] = CLIP(clipfix[1] * factor);
blue[i][j] = CLIP(clipfix[2] * factor);
} else {//some channels clipped
float notclipped[3] = {pixel[0] <= max_f[0] ? 1.f : 0.f, pixel[1] <= max_f[1] ? 1.f : 0.f, pixel[2] <= max_f[2] ? 1.f : 0.f};
@ -1180,27 +1174,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
}
}
}
if (recovered_full) {
#ifdef _OPENMP
#pragma omp parallel
#endif
gaussianBlur(color, temp, width, height, 3.f);
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = 0; i < height; ++i) {
for (int j = 0; j < width; ++j) {
int skip = recovered_full->skipIfZero(j, i);
if (skip) {
j += skip-1;
} else if (recovered_full->get(j, i)) {
color[i][j] = temp[i][j];
}
}
}
}
}
}