Fix another issue detected by cppcheck

This commit is contained in:
heckflosse
2018-11-22 19:10:34 +01:00
parent 190772af5e
commit 863649a4c2

View File

@@ -4396,17 +4396,11 @@ bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embed
// very effective to reduce (or remove) the magenta, but with levels of grey !
void RawImageSource::HLRecovery_blend(float* rin, float* gin, float* bin, int width, float maxval, float* hlmax)
{
const int ColorCount = 3;
constexpr int ColorCount = 3;
// Transform matrixes rgb>lab and back
static const float trans[2][ColorCount][ColorCount] = {
{ { 1, 1, 1 }, { 1.7320508, -1.7320508, 0 }, { -1, -1, 2 } },
{ { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } }
};
static const float itrans[2][ColorCount][ColorCount] = {
{ { 1, 0.8660254, -0.5 }, { 1, -0.8660254, -0.5 }, { 1, 0, 1 } },
{ { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } }
};
constexpr float trans[ColorCount][ColorCount] = { { 1, 1, 1 }, { 1.7320508, -1.7320508, 0 }, { -1, -1, 2 } };
constexpr float itrans[ColorCount][ColorCount] = { { 1, 0.8660254, -0.5 }, { 1, -0.8660254, -0.5 }, { 1, 0, 1 } };
#define FOREACHCOLOR for (int c=0; c < ColorCount; c++)
@@ -4463,7 +4457,7 @@ void RawImageSource::HLRecovery_blend(float* rin, float* gin, float* bin, int wi
for (int j = 0; j < ColorCount; j++)
{
lab[i][c] += trans[ColorCount - 3][c][j] * cam[i][j];
lab[i][c] += trans[c][j] * cam[i][j];
}
}
@@ -4487,7 +4481,7 @@ void RawImageSource::HLRecovery_blend(float* rin, float* gin, float* bin, int wi
for (int j = 0; j < ColorCount; j++)
{
cam[0][c] += itrans[ColorCount - 3][c][j] * lab[0][j];
cam[0][c] += itrans[c][j] * lab[0][j];
}
}
FOREACHCOLOR rgb[c] = cam[0][c] / ColorCount;