merge with Dev

This commit is contained in:
Desmis
2018-01-11 13:22:05 +01:00
29 changed files with 561 additions and 479 deletions

View File

@@ -56,7 +56,7 @@ using namespace rtengine;
void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize)
{
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
vfloat cr = F2V(0.299f);
vfloat cg = F2V(0.587f);
vfloat cb = F2V(0.114f);
@@ -64,7 +64,7 @@ void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
for (; j < tW - 3; j += 4, tj += 4) {
@@ -101,14 +101,14 @@ void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float
void highlightToneCurve(const LUTf &hltonecurve, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize, float exp_scale, float comp, float hlrange)
{
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
vfloat threev = F2V(3.f);
vfloat maxvalfv = F2V(MAXVALF);
#endif
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
for (; j < tW - 3; j += 4, tj += 4) {
@@ -170,7 +170,7 @@ void proPhotoBlue(float *rtemp, float *gtemp, float *btemp, int istart, int tH,
// this is a hack to avoid the blue=>black bug (Issue 2141)
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
for (; j < tW - 3; j += 4, tj += 4) {
vfloat rv = LVF(rtemp[ti * tileSize + tj]);
@@ -2191,7 +2191,9 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
const float pow1 = pow_F(1.64f - pow_F(0.29f, n), 0.73f);
float nj, nbbj, ncbj, czj, awj, flj;
Ciecam02::initcam2float(gamu, yb2, pilotout, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj, czj, awj, flj);
#ifdef __SSE2__
const float reccmcz = 1.f / (c2 * czj);
#endif
const float pow1n = pow_F(1.64f - pow_F(0.29f, nj), 0.73f);
const float epsil = 0.0001f;
@@ -2756,7 +2758,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
Ciecam02::jch2xyz_ciecam02float(xx, yy, zz,
J, C, h,
xw2, yw2, zw2,
f2, c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
float x, y, z;
x = xx * 655.35f;
y = yy * 655.35f;
@@ -2767,10 +2769,9 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
// gamut control in Lab mode; I must study how to do with cIECAM only
if (gamu == 1) {
float HH, Lprov1, Chprov1;
float Lprov1, Chprov1;
Lprov1 = Ll / 327.68f;
Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f;
HH = xatan2f(bb, aa);
float2 sincosval;
if (Chprov1 == 0.0f) {
@@ -3100,7 +3101,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
Ciecam02::jch2xyz_ciecam02float(xx, yy, zz,
ncie->J_p[i][j], ncie_C_p, ncie->h_p[i][j],
xw2, yw2, zw2,
f2, c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
float x = (float)xx * 655.35f;
float y = (float)yy * 655.35f;
float z = (float)zz * 655.35f;
@@ -3790,7 +3791,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
} else {
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
#if defined( __SSE2__ ) && defined( __x86_64__ )
for (; j < tW - 3; j += 4, tj += 4) {
//brightness/contrast
@@ -3959,22 +3960,14 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
}
if (sat != 0 || hCurveEnabled || sCurveEnabled || vCurveEnabled) {
const float satby100 = sat / 100.f;
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
const float satby100 = sat / 100.f;
float r = rtemp[ti * TS + tj];
float g = gtemp[ti * TS + tj];
float b = btemp[ti * TS + tj];
float h, s, v;
Color::rgb2hsv(r, g, b, h, s, v);
Color::rgb2hsvtc(rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], h, s, v);
h /= 6.f;
if (sat > 0) {
s = (1.f - satby100) * s + satby100 * (1.f - SQR(SQR(1.f - min(s, 1.0f))));
if (s < 0.f) {
s = 0.f;
}
s = std::max(0.f, intp(satby100, 1.f - SQR(SQR(1.f - std::min(s, 1.0f))), s));
} else { /*if (sat < 0)*/
s *= 1.f + satby100;
}
@@ -4029,7 +4022,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
}
Color::hsv2rgb(h, s, v, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]);
Color::hsv2rgbdcp(h * 6.f, s, v, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]);
}
}
}