cppcheck: further fixes

This commit is contained in:
Ingo Weyrich
2019-08-07 15:32:52 +02:00
parent 4fedfb2b26
commit 4c99c9cf01
6 changed files with 52 additions and 248 deletions

View File

@@ -970,8 +970,8 @@ void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue
for (int c = 0; c < 3; ++c) {
lab[i2][c] = 0;
for (int j = 0; j < 3; ++j) {
lab[i2][c] += trans[c][j] * cam[i2][j];
for (int j2 = 0; j2 < 3; ++j2) {
lab[i2][c] += trans[c][j2] * cam[i2][j2];
}
}
@@ -996,8 +996,8 @@ void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue
for (int c = 0; c < 3; ++c) {
cam[0][c] = 0.f;
for (int j = 0; j < 3; ++j) {
cam[0][c] += itrans[c][j] * lab[0][j];
for (int j2 = 0; j2 < 3; ++j2) {
cam[0][c] += itrans[c][j2] * lab[0][j2];
}
}
@@ -1081,12 +1081,11 @@ void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue
//now correct clipped channels
if (pixel[0] > max_f[0] && pixel[1] > max_f[1] && pixel[2] > max_f[2]) {
//all channels clipped
const float Y = 0.299f * clipfix[0] + 0.587f * clipfix[1] + 0.114f * clipfix[2];
const float factor = whitept / Y;
red[i + miny][j + minx] = clipfix[0] * factor;
green[i + miny][j + minx] = clipfix[1] * factor;
blue[i + miny][j + minx] = clipfix[2] * factor;
const float mult = whitept / (0.299f * clipfix[0] + 0.587f * clipfix[1] + 0.114f * clipfix[2]);
red[i + miny][j + minx] = clipfix[0] * mult;
green[i + miny][j + minx] = clipfix[1] * mult;
blue[i + miny][j + minx] = clipfix[2] * mult;
} else {//some channels clipped
const float notclipped[3] = {
pixel[0] <= max_f[0] ? 1.f : 0.f,
@@ -1113,11 +1112,11 @@ void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue
Y = 0.299f * red[i + miny][j + minx] + 0.587f * green[i + miny][j + minx] + 0.114f * blue[i + miny][j + minx];
if (Y > whitept) {
const float factor = whitept / Y;
const float mult = whitept / Y;
red[i + miny][j + minx] *= factor;
green[i + miny][j + minx] *= factor;
blue[i + miny][j + minx] *= factor;
red[i + miny][j + minx] *= mult;
green[i + miny][j + minx] *= mult;
blue[i + miny][j + minx] *= mult;
}
}
}