Fix coverity issues
This commit is contained in:
parent
7f32010895
commit
71b5cc6d65
@ -807,8 +807,8 @@ BENCHFUN
|
|||||||
#endif
|
#endif
|
||||||
const std::size_t blox_array_size = denoiseNestedLevels * numthreads;
|
const std::size_t blox_array_size = denoiseNestedLevels * numthreads;
|
||||||
|
|
||||||
float *LbloxArray[blox_array_size] = {};
|
float *LbloxArray[blox_array_size];
|
||||||
float *fLbloxArray[blox_array_size] = {};
|
float *fLbloxArray[blox_array_size];
|
||||||
|
|
||||||
for (std::size_t i = 0; i < blox_array_size; ++i) {
|
for (std::size_t i = 0; i < blox_array_size; ++i) {
|
||||||
LbloxArray[i] = nullptr;
|
LbloxArray[i] = nullptr;
|
||||||
@ -1748,7 +1748,7 @@ BENCHFUN
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < denoiseNestedLevels * numthreads; ++i) {
|
for (size_t i = 0; i < blox_array_size; ++i) {
|
||||||
if (LbloxArray[i]) {
|
if (LbloxArray[i]) {
|
||||||
fftwf_free(LbloxArray[i]);
|
fftwf_free(LbloxArray[i]);
|
||||||
}
|
}
|
||||||
|
@ -191,26 +191,26 @@ float Ciecam02::calculate_fl_from_la_ciecam02float ( float la )
|
|||||||
return (0.2f * k * la5) + (0.1f * (1.0f - k) * (1.0f - k) * std::cbrt (la5));
|
return (0.2f * k * la5) + (0.1f * (1.0f - k) * (1.0f - k) * std::cbrt (la5));
|
||||||
}
|
}
|
||||||
|
|
||||||
float Ciecam02::achromatic_response_to_whitefloat ( float x, float y, float z, float d, float fl, float nbb, int gamu )
|
float Ciecam02::achromatic_response_to_whitefloat ( float x, float y, float z, float d, float fl, float nbb )
|
||||||
{
|
{
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
float rc, gc, bc;
|
float rc, gc, bc;
|
||||||
float rp, gp, bp;
|
float rp, gp, bp;
|
||||||
float rpa, gpa, bpa;
|
float rpa, gpa, bpa;
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
xyz_to_cat02float ( r, g, b, x, y, z, gamu );
|
xyz_to_cat02float ( r, g, b, x, y, z);
|
||||||
|
|
||||||
rc = r * (((y * d) / r) + (1.0f - d));
|
rc = r * (((y * d) / r) + (1.0f - d));
|
||||||
gc = g * (((y * d) / g) + (1.0f - d));
|
gc = g * (((y * d) / g) + (1.0f - d));
|
||||||
bc = b * (((y * d) / b) + (1.0f - d));
|
bc = b * (((y * d) / b) + (1.0f - d));
|
||||||
|
|
||||||
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc, gamu );
|
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc);
|
||||||
|
|
||||||
if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
// if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
||||||
rp = MAXR (rp, 0.0f);
|
rp = MAXR (rp, 0.0f);
|
||||||
gp = MAXR (gp, 0.0f);
|
gp = MAXR (gp, 0.0f);
|
||||||
bp = MAXR (bp, 0.0f);
|
bp = MAXR (bp, 0.0f);
|
||||||
}
|
// }
|
||||||
|
|
||||||
rpa = nonlinear_adaptationfloat ( rp, fl );
|
rpa = nonlinear_adaptationfloat ( rp, fl );
|
||||||
gpa = nonlinear_adaptationfloat ( gp, fl );
|
gpa = nonlinear_adaptationfloat ( gp, fl );
|
||||||
@ -219,22 +219,22 @@ float Ciecam02::achromatic_response_to_whitefloat ( float x, float y, float z, f
|
|||||||
return ((2.0f * rpa) + gpa + ((1.0f / 20.0f) * bpa) - 0.305f) * nbb;
|
return ((2.0f * rpa) + gpa + ((1.0f / 20.0f) * bpa) - 0.305f) * nbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ciecam02::xyz_to_cat02float ( float &r, float &g, float &b, float x, float y, float z, int gamu )
|
void Ciecam02::xyz_to_cat02float ( float &r, float &g, float &b, float x, float y, float z)
|
||||||
{
|
{
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
|
//
|
||||||
if (gamu == 0) {
|
// if (gamu == 0) {
|
||||||
r = ( 0.7328f * x) + (0.4296f * y) - (0.1624f * z);
|
// r = ( 0.7328f * x) + (0.4296f * y) - (0.1624f * z);
|
||||||
g = (-0.7036f * x) + (1.6975f * y) + (0.0061f * z);
|
// g = (-0.7036f * x) + (1.6975f * y) + (0.0061f * z);
|
||||||
b = ( 0.0030f * x) + (0.0136f * y) + (0.9834f * z);
|
// b = ( 0.0030f * x) + (0.0136f * y) + (0.9834f * z);
|
||||||
} else if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
// } else if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
||||||
//r = ( 0.7328 * x) + (0.4296 * y) - (0.1624 * z);
|
//r = ( 0.7328 * x) + (0.4296 * y) - (0.1624 * z);
|
||||||
//g = (-0.7036 * x) + (1.6975 * y) + (0.0061 * z);
|
//g = (-0.7036 * x) + (1.6975 * y) + (0.0061 * z);
|
||||||
//b = ( 0.0000 * x) + (0.0000 * y) + (1.0000 * z);
|
//b = ( 0.0000 * x) + (0.0000 * y) + (1.0000 * z);
|
||||||
r = ( 1.007245f * x) + (0.011136f * y) - (0.018381f * z); //Changjun Li
|
r = ( 1.007245f * x) + (0.011136f * y) - (0.018381f * z); //Changjun Li
|
||||||
g = (-0.318061f * x) + (1.314589f * y) + (0.003471f * z);
|
g = (-0.318061f * x) + (1.314589f * y) + (0.003471f * z);
|
||||||
b = ( 0.0000f * x) + (0.0000f * y) + (1.0000f * z);
|
b = ( 0.0000f * x) + (0.0000f * y) + (1.0000f * z);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
void Ciecam02::xyz_to_cat02float ( vfloat &r, vfloat &g, vfloat &b, vfloat x, vfloat y, vfloat z )
|
void Ciecam02::xyz_to_cat02float ( vfloat &r, vfloat &g, vfloat &b, vfloat x, vfloat y, vfloat z )
|
||||||
@ -246,22 +246,22 @@ void Ciecam02::xyz_to_cat02float ( vfloat &r, vfloat &g, vfloat &b, vfloat x, vf
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Ciecam02::cat02_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b, int gamu )
|
void Ciecam02::cat02_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b)
|
||||||
{
|
{
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
|
//
|
||||||
if (gamu == 0) {
|
// if (gamu == 0) {
|
||||||
x = ( 1.096124f * r) - (0.278869f * g) + (0.182745f * b);
|
// x = ( 1.096124f * r) - (0.278869f * g) + (0.182745f * b);
|
||||||
y = ( 0.454369f * r) + (0.473533f * g) + (0.072098f * b);
|
// y = ( 0.454369f * r) + (0.473533f * g) + (0.072098f * b);
|
||||||
z = (-0.009628f * r) - (0.005698f * g) + (1.015326f * b);
|
// z = (-0.009628f * r) - (0.005698f * g) + (1.015326f * b);
|
||||||
} else if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
// } else if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
||||||
//x = ( 1.0978566 * r) - (0.277843 * g) + (0.179987 * b);
|
//x = ( 1.0978566 * r) - (0.277843 * g) + (0.179987 * b);
|
||||||
//y = ( 0.455053 * r) + (0.473938 * g) + (0.0710096* b);
|
//y = ( 0.455053 * r) + (0.473938 * g) + (0.0710096* b);
|
||||||
//z = ( 0.000000 * r) - (0.000000 * g) + (1.000000 * b);
|
//z = ( 0.000000 * r) - (0.000000 * g) + (1.000000 * b);
|
||||||
x = ( 0.99015849f * r) - (0.00838772f * g) + (0.018229217f * b); //Changjun Li
|
x = ( 0.99015849f * r) - (0.00838772f * g) + (0.018229217f * b); //Changjun Li
|
||||||
y = ( 0.239565979f * r) + (0.758664642f * g) + (0.001770137f * b);
|
y = ( 0.239565979f * r) + (0.758664642f * g) + (0.001770137f * b);
|
||||||
z = ( 0.000000f * r) - (0.000000f * g) + (1.000000f * b);
|
z = ( 0.000000f * r) - (0.000000f * g) + (1.000000f * b);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
void Ciecam02::cat02_to_xyzfloat ( vfloat &x, vfloat &y, vfloat &z, vfloat r, vfloat g, vfloat b )
|
void Ciecam02::cat02_to_xyzfloat ( vfloat &x, vfloat &y, vfloat &z, vfloat r, vfloat g, vfloat b )
|
||||||
@ -288,19 +288,19 @@ void Ciecam02::hpe_to_xyzfloat ( vfloat &x, vfloat &y, vfloat &z, vfloat r, vflo
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Ciecam02::cat02_to_hpefloat ( float &rh, float &gh, float &bh, float r, float g, float b, int gamu )
|
void Ciecam02::cat02_to_hpefloat ( float &rh, float &gh, float &bh, float r, float g, float b)
|
||||||
{
|
{
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
|
//
|
||||||
if (gamu == 0) {
|
// if (gamu == 0) {
|
||||||
rh = ( 0.7409792f * r) + (0.2180250f * g) + (0.0410058f * b);
|
// rh = ( 0.7409792f * r) + (0.2180250f * g) + (0.0410058f * b);
|
||||||
gh = ( 0.2853532f * r) + (0.6242014f * g) + (0.0904454f * b);
|
// gh = ( 0.2853532f * r) + (0.6242014f * g) + (0.0904454f * b);
|
||||||
bh = (-0.0096280f * r) - (0.0056980f * g) + (1.0153260f * b);
|
// bh = (-0.0096280f * r) - (0.0056980f * g) + (1.0153260f * b);
|
||||||
} else if (gamu == 1) { //Changjun Li
|
// } else if (gamu == 1) { //Changjun Li
|
||||||
rh = ( 0.550930835f * r) + (0.519435987f * g) - ( 0.070356303f * b);
|
rh = ( 0.550930835f * r) + (0.519435987f * g) - ( 0.070356303f * b);
|
||||||
gh = ( 0.055954056f * r) + (0.89973132f * g) + (0.044315524f * b);
|
gh = ( 0.055954056f * r) + (0.89973132f * g) + (0.044315524f * b);
|
||||||
bh = (0.0f * r) - (0.0f * g) + (1.0f * b);
|
bh = (0.0f * r) - (0.0f * g) + (1.0f * b);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
@ -407,7 +407,7 @@ void Ciecam02::calculate_abfloat ( vfloat &aa, vfloat &bb, vfloat h, vfloat e, v
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Ciecam02::initcam1float (float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
void Ciecam02::initcam1float (float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
||||||
float &cz, float &aw, float &wh, float &pfl, float &fl, float &c)
|
float &cz, float &aw, float &wh, float &pfl, float &fl, float &c)
|
||||||
{
|
{
|
||||||
n = yb / yw;
|
n = yb / yw;
|
||||||
@ -421,7 +421,7 @@ void Ciecam02::initcam1float (float gamu, float yb, float pilotd, float f, float
|
|||||||
fl = calculate_fl_from_la_ciecam02float ( la );
|
fl = calculate_fl_from_la_ciecam02float ( la );
|
||||||
nbb = ncb = 0.725f * pow_F ( 1.0f / n, 0.2f );
|
nbb = ncb = 0.725f * pow_F ( 1.0f / n, 0.2f );
|
||||||
cz = 1.48f + sqrt ( n );
|
cz = 1.48f + sqrt ( n );
|
||||||
aw = achromatic_response_to_whitefloat ( xw, yw, zw, d, fl, nbb, gamu );
|
aw = achromatic_response_to_whitefloat ( xw, yw, zw, d, fl, nbb);
|
||||||
wh = ( 4.0f / c ) * ( aw + 4.0f ) * pow_F ( fl, 0.25f );
|
wh = ( 4.0f / c ) * ( aw + 4.0f ) * pow_F ( fl, 0.25f );
|
||||||
pfl = pow_F ( fl, 0.25f );
|
pfl = pow_F ( fl, 0.25f );
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -433,7 +433,7 @@ void Ciecam02::initcam1float (float gamu, float yb, float pilotd, float f, float
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ciecam02::initcam2float (float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
void Ciecam02::initcam2float (float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
||||||
float &cz, float &aw, float &fl)
|
float &cz, float &aw, float &fl)
|
||||||
{
|
{
|
||||||
n = yb / yw;
|
n = yb / yw;
|
||||||
@ -448,7 +448,7 @@ void Ciecam02::initcam2float (float gamu, float yb, float pilotd, float f, float
|
|||||||
fl = calculate_fl_from_la_ciecam02float ( la );
|
fl = calculate_fl_from_la_ciecam02float ( la );
|
||||||
nbb = ncb = 0.725f * pow_F ( 1.0f / n, 0.2f );
|
nbb = ncb = 0.725f * pow_F ( 1.0f / n, 0.2f );
|
||||||
cz = 1.48f + sqrt ( n );
|
cz = 1.48f + sqrt ( n );
|
||||||
aw = achromatic_response_to_whitefloat ( xw, yw, zw, d, fl, nbb, gamu );
|
aw = achromatic_response_to_whitefloat ( xw, yw, zw, d, fl, nbb);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
||||||
if (settings->verbose) {
|
if (settings->verbose) {
|
||||||
@ -460,7 +460,7 @@ void Ciecam02::initcam2float (float gamu, float yb, float pilotd, float f, float
|
|||||||
|
|
||||||
void Ciecam02::xyz2jchqms_ciecam02float ( float &J, float &C, float &h, float &Q, float &M, float &s, float aw, float fl, float wh,
|
void Ciecam02::xyz2jchqms_ciecam02float ( float &J, float &C, float &h, float &Q, float &M, float &s, float aw, float fl, float wh,
|
||||||
float x, float y, float z, float xw, float yw, float zw,
|
float x, float y, float z, float xw, float yw, float zw,
|
||||||
float c, float nc, int gamu, float pow1, float nbb, float ncb, float pfl, float cz, float d)
|
float c, float nc, float pow1, float nbb, float ncb, float pfl, float cz, float d)
|
||||||
|
|
||||||
{
|
{
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
@ -471,20 +471,20 @@ void Ciecam02::xyz2jchqms_ciecam02float ( float &J, float &C, float &h, float &Q
|
|||||||
float a, ca, cb;
|
float a, ca, cb;
|
||||||
float e, t;
|
float e, t;
|
||||||
float myh;
|
float myh;
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
xyz_to_cat02float ( r, g, b, x, y, z, gamu );
|
xyz_to_cat02float ( r, g, b, x, y, z);
|
||||||
xyz_to_cat02float ( rw, gw, bw, xw, yw, zw, gamu );
|
xyz_to_cat02float ( rw, gw, bw, xw, yw, zw);
|
||||||
rc = r * (((yw * d) / rw) + (1.f - d));
|
rc = r * (((yw * d) / rw) + (1.f - d));
|
||||||
gc = g * (((yw * d) / gw) + (1.f - d));
|
gc = g * (((yw * d) / gw) + (1.f - d));
|
||||||
bc = b * (((yw * d) / bw) + (1.f - d));
|
bc = b * (((yw * d) / bw) + (1.f - d));
|
||||||
|
|
||||||
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc, gamu );
|
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc);
|
||||||
|
|
||||||
if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
// if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
||||||
rp = MAXR (rp, 0.0f);
|
rp = MAXR (rp, 0.0f);
|
||||||
gp = MAXR (gp, 0.0f);
|
gp = MAXR (gp, 0.0f);
|
||||||
bp = MAXR (bp, 0.0f);
|
bp = MAXR (bp, 0.0f);
|
||||||
}
|
// }
|
||||||
|
|
||||||
rpa = nonlinear_adaptationfloat ( rp, fl );
|
rpa = nonlinear_adaptationfloat ( rp, fl );
|
||||||
gpa = nonlinear_adaptationfloat ( gp, fl );
|
gpa = nonlinear_adaptationfloat ( gp, fl );
|
||||||
@ -501,9 +501,9 @@ void Ciecam02::xyz2jchqms_ciecam02float ( float &J, float &C, float &h, float &Q
|
|||||||
|
|
||||||
a = ((2.0f * rpa) + gpa + (0.05f * bpa) - 0.305f) * nbb;
|
a = ((2.0f * rpa) + gpa + (0.05f * bpa) - 0.305f) * nbb;
|
||||||
|
|
||||||
if (gamu == 1) {
|
// if (gamu == 1) {
|
||||||
a = MAXR (a, 0.0f); //gamut correction M.H.Brill S.Susstrunk
|
a = MAXR (a, 0.0f); //gamut correction M.H.Brill S.Susstrunk
|
||||||
}
|
// }
|
||||||
|
|
||||||
J = pow_F ( a / aw, c * cz * 0.5f);
|
J = pow_F ( a / aw, c * cz * 0.5f);
|
||||||
|
|
||||||
@ -590,20 +590,20 @@ void Ciecam02::xyz2jch_ciecam02float ( float &J, float &C, float &h, float aw, f
|
|||||||
float a, ca, cb;
|
float a, ca, cb;
|
||||||
float e, t;
|
float e, t;
|
||||||
float myh;
|
float myh;
|
||||||
int gamu = 1;
|
// int gamu = 1;
|
||||||
xyz_to_cat02float ( r, g, b, x, y, z, gamu );
|
xyz_to_cat02float ( r, g, b, x, y, z);
|
||||||
xyz_to_cat02float ( rw, gw, bw, xw, yw, zw, gamu );
|
xyz_to_cat02float ( rw, gw, bw, xw, yw, zw);
|
||||||
rc = r * (((yw * d) / rw) + (1.f - d));
|
rc = r * (((yw * d) / rw) + (1.f - d));
|
||||||
gc = g * (((yw * d) / gw) + (1.f - d));
|
gc = g * (((yw * d) / gw) + (1.f - d));
|
||||||
bc = b * (((yw * d) / bw) + (1.f - d));
|
bc = b * (((yw * d) / bw) + (1.f - d));
|
||||||
|
|
||||||
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc, gamu );
|
cat02_to_hpefloat ( rp, gp, bp, rc, gc, bc);
|
||||||
|
|
||||||
if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
// if (gamu == 1) { //gamut correction M.H.Brill S.Susstrunk
|
||||||
rp = MAXR (rp, 0.0f);
|
rp = MAXR (rp, 0.0f);
|
||||||
gp = MAXR (gp, 0.0f);
|
gp = MAXR (gp, 0.0f);
|
||||||
bp = MAXR (bp, 0.0f);
|
bp = MAXR (bp, 0.0f);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
vfloat pv = _mm_setr_ps(rp, gp, bp, 1.f);
|
vfloat pv = _mm_setr_ps(rp, gp, bp, 1.f);
|
||||||
@ -629,9 +629,9 @@ void Ciecam02::xyz2jch_ciecam02float ( float &J, float &C, float &h, float aw, f
|
|||||||
|
|
||||||
a = ((2.0f * rpa) + gpa + (0.05f * bpa) - 0.305f) * nbb;
|
a = ((2.0f * rpa) + gpa + (0.05f * bpa) - 0.305f) * nbb;
|
||||||
|
|
||||||
if (gamu == 1) {
|
// if (gamu == 1) {
|
||||||
a = MAXR (a, 0.0f); //gamut correction M.H.Brill S.Susstrunk
|
a = MAXR (a, 0.0f); //gamut correction M.H.Brill S.Susstrunk
|
||||||
}
|
// }
|
||||||
|
|
||||||
J = pow_F ( a / aw, c * cz * 0.5f);
|
J = pow_F ( a / aw, c * cz * 0.5f);
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ void Ciecam02::xyz2jch_ciecam02float ( float &J, float &C, float &h, float aw, f
|
|||||||
|
|
||||||
void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, float C, float h,
|
void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, float C, float h,
|
||||||
float xw, float yw, float zw,
|
float xw, float yw, float zw,
|
||||||
float c, float nc, int gamu, float pow1, float nbb, float ncb, float fl, float cz, float d, float aw)
|
float c, float nc, float pow1, float nbb, float ncb, float fl, float cz, float d, float aw)
|
||||||
{
|
{
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
float rc, gc, bc;
|
float rc, gc, bc;
|
||||||
@ -655,8 +655,8 @@ void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, fl
|
|||||||
float rw, gw, bw;
|
float rw, gw, bw;
|
||||||
float a, ca, cb;
|
float a, ca, cb;
|
||||||
float e, t;
|
float e, t;
|
||||||
gamu = 1;
|
// gamu = 1;
|
||||||
xyz_to_cat02float(rw, gw, bw, xw, yw, zw, gamu);
|
xyz_to_cat02float(rw, gw, bw, xw, yw, zw);
|
||||||
e = ((961.53846f) * nc * ncb) * (xcosf(h * rtengine::RT_PI_F_180 + 2.0f) + 3.8f);
|
e = ((961.53846f) * nc * ncb) * (xcosf(h * rtengine::RT_PI_F_180 + 2.0f) + 3.8f);
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
@ -686,13 +686,13 @@ void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, fl
|
|||||||
bp = inverse_nonlinear_adaptationfloat(bpa, fl);
|
bp = inverse_nonlinear_adaptationfloat(bpa, fl);
|
||||||
#endif
|
#endif
|
||||||
hpe_to_xyzfloat(x, y, z, rp, gp, bp);
|
hpe_to_xyzfloat(x, y, z, rp, gp, bp);
|
||||||
xyz_to_cat02float(rc, gc, bc, x, y, z, gamu);
|
xyz_to_cat02float(rc, gc, bc, x, y, z);
|
||||||
|
|
||||||
r = rc / (((yw * d) / rw) + (1.0f - d));
|
r = rc / (((yw * d) / rw) + (1.0f - d));
|
||||||
g = gc / (((yw * d) / gw) + (1.0f - d));
|
g = gc / (((yw * d) / gw) + (1.0f - d));
|
||||||
b = bc / (((yw * d) / bw) + (1.0f - d));
|
b = bc / (((yw * d) / bw) + (1.0f - d));
|
||||||
|
|
||||||
cat02_to_xyzfloat(x, y, z, r, g, b, gamu);
|
cat02_to_xyzfloat(x, y, z, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
|
@ -30,9 +30,9 @@ class Ciecam02
|
|||||||
private:
|
private:
|
||||||
static float d_factorfloat ( float f, float la );
|
static float d_factorfloat ( float f, float la );
|
||||||
static float calculate_fl_from_la_ciecam02float ( float la );
|
static float calculate_fl_from_la_ciecam02float ( float la );
|
||||||
static float achromatic_response_to_whitefloat ( float x, float y, float z, float d, float fl, float nbb, int gamu );
|
static float achromatic_response_to_whitefloat ( float x, float y, float z, float d, float fl, float nbb);
|
||||||
static void xyz_to_cat02float ( float &r, float &g, float &b, float x, float y, float z, int gamu );
|
static void xyz_to_cat02float ( float &r, float &g, float &b, float x, float y, float z);
|
||||||
static void cat02_to_hpefloat ( float &rh, float &gh, float &bh, float r, float g, float b, int gamu );
|
static void cat02_to_hpefloat ( float &rh, float &gh, float &bh, float r, float g, float b);
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
static void xyz_to_cat02float ( vfloat &r, vfloat &g, vfloat &b, vfloat x, vfloat y, vfloat z );
|
static void xyz_to_cat02float ( vfloat &r, vfloat &g, vfloat &b, vfloat x, vfloat y, vfloat z );
|
||||||
@ -46,7 +46,7 @@ private:
|
|||||||
static void calculate_abfloat ( float &aa, float &bb, float h, float e, float t, float nbb, float a );
|
static void calculate_abfloat ( float &aa, float &bb, float h, float e, float t, float nbb, float a );
|
||||||
static void Aab_to_rgbfloat ( float &r, float &g, float &b, float A, float aa, float bb, float nbb );
|
static void Aab_to_rgbfloat ( float &r, float &g, float &b, float A, float aa, float bb, float nbb );
|
||||||
static void hpe_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b );
|
static void hpe_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b );
|
||||||
static void cat02_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b, int gamu );
|
static void cat02_to_xyzfloat ( float &x, float &y, float &z, float r, float g, float b);
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
static vfloat inverse_nonlinear_adaptationfloat ( vfloat c, vfloat fl );
|
static vfloat inverse_nonlinear_adaptationfloat ( vfloat c, vfloat fl );
|
||||||
static void calculate_abfloat ( vfloat &aa, vfloat &bb, vfloat h, vfloat e, vfloat t, vfloat nbb, vfloat a );
|
static void calculate_abfloat ( vfloat &aa, vfloat &bb, vfloat h, vfloat e, vfloat t, vfloat nbb, vfloat a );
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
static void jch2xyz_ciecam02float ( float &x, float &y, float &z,
|
static void jch2xyz_ciecam02float ( float &x, float &y, float &z,
|
||||||
float J, float C, float h,
|
float J, float C, float h,
|
||||||
float xw, float yw, float zw,
|
float xw, float yw, float zw,
|
||||||
float c, float nc, int gamu, float n, float nbb, float ncb, float fl, float cz, float d, float aw );
|
float c, float nc, float n, float nbb, float ncb, float fl, float cz, float d, float aw );
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
static void jch2xyz_ciecam02float ( vfloat &x, vfloat &y, vfloat &z,
|
static void jch2xyz_ciecam02float ( vfloat &x, vfloat &y, vfloat &z,
|
||||||
vfloat J, vfloat C, vfloat h,
|
vfloat J, vfloat C, vfloat h,
|
||||||
@ -76,10 +76,10 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Forward transform from XYZ to CIECAM02 JCh.
|
* Forward transform from XYZ to CIECAM02 JCh.
|
||||||
*/
|
*/
|
||||||
static void initcam1float (float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
static void initcam1float (float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
||||||
float &cz, float &aw, float &wh, float &pfl, float &fl, float &c);
|
float &cz, float &aw, float &wh, float &pfl, float &fl, float &c);
|
||||||
|
|
||||||
static void initcam2float (float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
static void initcam2float (float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb,
|
||||||
float &cz, float &aw, float &fl);
|
float &cz, float &aw, float &fl);
|
||||||
|
|
||||||
static void xyz2jch_ciecam02float ( float &J, float &C, float &h,
|
static void xyz2jch_ciecam02float ( float &J, float &C, float &h,
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
float &Q, float &M, float &s, float aw, float fl, float wh,
|
float &Q, float &M, float &s, float aw, float fl, float wh,
|
||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
float xw, float yw, float zw,
|
float xw, float yw, float zw,
|
||||||
float c, float nc, int gamu, float n, float nbb, float ncb, float pfl, float cz, float d );
|
float c, float nc, float n, float nbb, float ncb, float pfl, float cz, float d );
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
static void xyz2jchqms_ciecam02float ( vfloat &J, vfloat &C, vfloat &h,
|
static void xyz2jchqms_ciecam02float ( vfloat &J, vfloat &C, vfloat &h,
|
||||||
|
@ -2040,7 +2040,7 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
|
|||||||
Ciecam02::jch2xyz_ciecam02float( x, y, z,
|
Ciecam02::jch2xyz_ciecam02float( x, y, z,
|
||||||
J, C, h,
|
J, C, h,
|
||||||
xw, yw, zw,
|
xw, yw, zw,
|
||||||
c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw );
|
c, nc, pow1, nbb, ncb, fl, cz, d, aw );
|
||||||
|
|
||||||
if (!isfinite(x) || !isfinite(y) || !isfinite(z)) {
|
if (!isfinite(x) || !isfinite(y) || !isfinite(z)) {
|
||||||
// can happen for colours on the rim of being outside gamut, that worked without chroma scaling but not with. Then we return only the curve's result.
|
// can happen for colours on the rim of being outside gamut, that worked without chroma scaling but not with. Then we return only the curve's result.
|
||||||
@ -2123,7 +2123,7 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
|
|||||||
}
|
}
|
||||||
float PerceptualToneCurve::cf_range[2];
|
float PerceptualToneCurve::cf_range[2];
|
||||||
float PerceptualToneCurve::cf[1000];
|
float PerceptualToneCurve::cf[1000];
|
||||||
float PerceptualToneCurve::f, PerceptualToneCurve::c, PerceptualToneCurve::nc, PerceptualToneCurve::yb, PerceptualToneCurve::la, PerceptualToneCurve::xw, PerceptualToneCurve::yw, PerceptualToneCurve::zw, PerceptualToneCurve::gamut;
|
float PerceptualToneCurve::f, PerceptualToneCurve::c, PerceptualToneCurve::nc, PerceptualToneCurve::yb, PerceptualToneCurve::la, PerceptualToneCurve::xw, PerceptualToneCurve::yw, PerceptualToneCurve::zw;
|
||||||
float PerceptualToneCurve::n, PerceptualToneCurve::d, PerceptualToneCurve::nbb, PerceptualToneCurve::ncb, PerceptualToneCurve::cz, PerceptualToneCurve::aw, PerceptualToneCurve::wh, PerceptualToneCurve::pfl, PerceptualToneCurve::fl, PerceptualToneCurve::pow1;
|
float PerceptualToneCurve::n, PerceptualToneCurve::d, PerceptualToneCurve::nbb, PerceptualToneCurve::ncb, PerceptualToneCurve::cz, PerceptualToneCurve::aw, PerceptualToneCurve::wh, PerceptualToneCurve::pfl, PerceptualToneCurve::fl, PerceptualToneCurve::pow1;
|
||||||
|
|
||||||
void PerceptualToneCurve::init()
|
void PerceptualToneCurve::init()
|
||||||
@ -2139,7 +2139,7 @@ void PerceptualToneCurve::init()
|
|||||||
c = 0.69f;
|
c = 0.69f;
|
||||||
nc = 1.00f;
|
nc = 1.00f;
|
||||||
|
|
||||||
Ciecam02::initcam1float(gamut, yb, 1.f, f, la, xw, yw, zw, n, d, nbb, ncb,
|
Ciecam02::initcam1float(yb, 1.f, f, la, xw, yw, zw, n, d, nbb, ncb,
|
||||||
cz, aw, wh, pfl, fl, c);
|
cz, aw, wh, pfl, fl, c);
|
||||||
pow1 = pow_F( 1.64f - pow_F( 0.29f, n ), 0.73f );
|
pow1 = pow_F( 1.64f - pow_F( 0.29f, n ), 0.73f );
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ private:
|
|||||||
static float cf_range[2];
|
static float cf_range[2];
|
||||||
static float cf[1000];
|
static float cf[1000];
|
||||||
// for ciecam02
|
// for ciecam02
|
||||||
static float f, c, nc, yb, la, xw, yw, zw, gamut;
|
static float f, c, nc, yb, la, xw, yw, zw;
|
||||||
static float n, d, nbb, ncb, cz, aw, wh, pfl, fl, pow1;
|
static float n, d, nbb, ncb, cz, aw, wh, pfl, fl, pow1;
|
||||||
|
|
||||||
static void cubic_spline(const float x[], const float y[], const int len, const float out_x[], float out_y[], const int out_len);
|
static void cubic_spline(const float x[], const float y[], const int len, const float out_x[], float out_y[], const int out_len);
|
||||||
|
@ -910,12 +910,12 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw
|
|||||||
|
|
||||||
|
|
||||||
float cz, wh, pfl;
|
float cz, wh, pfl;
|
||||||
Ciecam02::initcam1float (gamu, yb, pilot, f, la, xw, yw, zw, n, d, nbb, ncb, cz, aw, wh, pfl, fl, c);
|
Ciecam02::initcam1float (yb, pilot, f, la, xw, yw, zw, n, d, nbb, ncb, cz, aw, wh, pfl, fl, c);
|
||||||
//printf ("wh=%f \n", wh);
|
//printf ("wh=%f \n", wh);
|
||||||
|
|
||||||
const float pow1 = pow_F ( 1.64f - pow_F ( 0.29f, n ), 0.73f );
|
const float pow1 = pow_F ( 1.64f - pow_F ( 0.29f, n ), 0.73f );
|
||||||
float nj, nbbj, ncbj, czj, awj, flj;
|
float nj, nbbj, ncbj, czj, awj, flj;
|
||||||
Ciecam02::initcam2float (gamu, yb2, pilotout, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj, czj, awj, flj);
|
Ciecam02::initcam2float (yb2, pilotout, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj, czj, awj, flj);
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
const float reccmcz = 1.f / (c2 * czj);
|
const float reccmcz = 1.f / (c2 * czj);
|
||||||
#endif
|
#endif
|
||||||
@ -1030,7 +1030,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw
|
|||||||
Q, M, s, aw, fl, wh,
|
Q, M, s, aw, fl, wh,
|
||||||
x, y, z,
|
x, y, z,
|
||||||
xw1, yw1, zw1,
|
xw1, yw1, zw1,
|
||||||
c, nc, gamu, pow1, nbb, ncb, pfl, cz, d);
|
c, nc, pow1, nbb, ncb, pfl, cz, d);
|
||||||
Jbuffer[k] = J;
|
Jbuffer[k] = J;
|
||||||
Cbuffer[k] = C;
|
Cbuffer[k] = C;
|
||||||
hbuffer[k] = h;
|
hbuffer[k] = h;
|
||||||
@ -1068,7 +1068,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw
|
|||||||
Q, M, s, aw, fl, wh,
|
Q, M, s, aw, fl, wh,
|
||||||
x, y, z,
|
x, y, z,
|
||||||
xw1, yw1, zw1,
|
xw1, yw1, zw1,
|
||||||
c, nc, gamu, pow1, nbb, ncb, pfl, cz, d);
|
c, nc, pow1, nbb, ncb, pfl, cz, d);
|
||||||
#endif
|
#endif
|
||||||
float Jpro, Cpro, hpro, Qpro, Mpro, spro;
|
float Jpro, Cpro, hpro, Qpro, Mpro, spro;
|
||||||
Jpro = J;
|
Jpro = J;
|
||||||
@ -1483,7 +1483,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw
|
|||||||
Ciecam02::jch2xyz_ciecam02float ( xx, yy, zz,
|
Ciecam02::jch2xyz_ciecam02float ( xx, yy, zz,
|
||||||
J, C, h,
|
J, C, h,
|
||||||
xw2, yw2, zw2,
|
xw2, yw2, zw2,
|
||||||
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
|
c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj);
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
x = xx * 655.35f;
|
x = xx * 655.35f;
|
||||||
y = yy * 655.35f;
|
y = yy * 655.35f;
|
||||||
@ -1816,7 +1816,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw
|
|||||||
Ciecam02::jch2xyz_ciecam02float ( xx, yy, zz,
|
Ciecam02::jch2xyz_ciecam02float ( xx, yy, zz,
|
||||||
ncie->J_p[i][j], ncie_C_p, ncie->h_p[i][j],
|
ncie->J_p[i][j], ncie_C_p, ncie->h_p[i][j],
|
||||||
xw2, yw2, zw2,
|
xw2, yw2, zw2,
|
||||||
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
|
c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj);
|
||||||
float x = (float)xx * 655.35f;
|
float x = (float)xx * 655.35f;
|
||||||
float y = (float)yy * 655.35f;
|
float y = (float)yy * 655.35f;
|
||||||
float z = (float)zz * 655.35f;
|
float z = (float)zz * 655.35f;
|
||||||
|
@ -231,7 +231,8 @@ void ImProcFunctions::Lanczos (const LabImage* src, LabImage* dst, float scale)
|
|||||||
float* const la = aligned_buffer_la.data;
|
float* const la = aligned_buffer_la.data;
|
||||||
float* const lb = aligned_buffer_lb.data;
|
float* const lb = aligned_buffer_lb.data;
|
||||||
// weights for interpolation in y direction
|
// weights for interpolation in y direction
|
||||||
float w[support] ALIGNED64 = {};
|
float w[support] ALIGNED64;
|
||||||
|
memset(w, 0, sizeof(w));
|
||||||
|
|
||||||
// Phase 2: do actual interpolation
|
// Phase 2: do actual interpolation
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user