started work on making RT not clip the image at intermediate stages
This commit is contained in:
@@ -50,10 +50,13 @@
|
||||
namespace {
|
||||
|
||||
using namespace rtengine;
|
||||
// begin of helper function for rgbProc()
|
||||
void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize) {
|
||||
|
||||
#ifdef __SSE2__
|
||||
|
||||
// begin of helper function for rgbProc()
|
||||
void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize)
|
||||
{
|
||||
|
||||
#if defined( __SSE2__ ) && defined( __x86_64__ )
|
||||
vfloat cr = F2V(0.299f);
|
||||
vfloat cg = F2V(0.587f);
|
||||
vfloat cb = F2V(0.114f);
|
||||
@@ -61,8 +64,9 @@ 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__
|
||||
for (; j < tW - 3; j+=4, tj+=4) {
|
||||
#if defined( __SSE2__ ) && defined( __x86_64__ )
|
||||
|
||||
for (; j < tW - 3; j += 4, tj += 4) {
|
||||
|
||||
vfloat rv = LVF(rtemp[ti * tileSize + tj]);
|
||||
vfloat gv = LVF(gtemp[ti * tileSize + tj]);
|
||||
@@ -75,7 +79,9 @@ void shadowToneCurve(const LUTf &shtonecurve, float *rtemp, float *gtemp, float
|
||||
STVF(gtemp[ti * tileSize + tj], gv * tonefactorv);
|
||||
STVF(btemp[ti * tileSize + tj], bv * tonefactorv);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for (; j < tW; j++, tj++) {
|
||||
|
||||
float r = rtemp[ti * tileSize + tj];
|
||||
@@ -92,17 +98,19 @@ 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) {
|
||||
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__
|
||||
for (; j < tW - 3; j+=4, tj+=4) {
|
||||
#if defined( __SSE2__ ) && defined( __x86_64__ )
|
||||
|
||||
for (; j < tW - 3; j += 4, tj += 4) {
|
||||
|
||||
vfloat rv = LVF(rtemp[ti * tileSize + tj]);
|
||||
vfloat gv = LVF(gtemp[ti * tileSize + tj]);
|
||||
@@ -111,14 +119,15 @@ void highlightToneCurve(const LUTf &hltonecurve, float *rtemp, float *gtemp, flo
|
||||
//TODO: proper treatment of out-of-gamut colors
|
||||
//float tonefactor = hltonecurve[(0.299f*r+0.587f*g+0.114f*b)];
|
||||
vmask maxMask = vmaskf_ge(vmaxf(rv, vmaxf(gv, bv)), maxvalfv);
|
||||
if(_mm_movemask_ps((vfloat)maxMask)) {
|
||||
|
||||
if (_mm_movemask_ps((vfloat)maxMask)) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
float r = rtemp[ti * tileSize + tj + k];
|
||||
float g = gtemp[ti * tileSize + tj + k];
|
||||
float b = btemp[ti * tileSize + tj + k];
|
||||
float tonefactor = ((r < MAXVALF ? hltonecurve[r] : CurveFactory::hlcurve (exp_scale, comp, hlrange, r) ) +
|
||||
(g < MAXVALF ? hltonecurve[g] : CurveFactory::hlcurve (exp_scale, comp, hlrange, g) ) +
|
||||
(b < MAXVALF ? hltonecurve[b] : CurveFactory::hlcurve (exp_scale, comp, hlrange, b) ) ) / 3.0;
|
||||
float tonefactor = ((r < MAXVALF ? hltonecurve[r] : CurveFactory::hlcurve(exp_scale, comp, hlrange, r)) +
|
||||
(g < MAXVALF ? hltonecurve[g] : CurveFactory::hlcurve(exp_scale, comp, hlrange, g)) +
|
||||
(b < MAXVALF ? hltonecurve[b] : CurveFactory::hlcurve(exp_scale, comp, hlrange, b))) / 3.0;
|
||||
|
||||
// note: tonefactor includes exposure scaling, that is here exposure slider and highlight compression takes place
|
||||
rtemp[ti * tileSize + tj + k] = r * tonefactor;
|
||||
@@ -133,7 +142,9 @@ void highlightToneCurve(const LUTf &hltonecurve, float *rtemp, float *gtemp, flo
|
||||
STVF(btemp[ti * tileSize + tj], bv * tonefactorv);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for (; j < tW; j++, tj++) {
|
||||
|
||||
float r = rtemp[ti * tileSize + tj];
|
||||
@@ -142,9 +153,9 @@ void highlightToneCurve(const LUTf &hltonecurve, float *rtemp, float *gtemp, flo
|
||||
|
||||
//TODO: proper treatment of out-of-gamut colors
|
||||
//float tonefactor = hltonecurve[(0.299f*r+0.587f*g+0.114f*b)];
|
||||
float tonefactor = ((r < MAXVALF ? hltonecurve[r] : CurveFactory::hlcurve (exp_scale, comp, hlrange, r) ) +
|
||||
(g < MAXVALF ? hltonecurve[g] : CurveFactory::hlcurve (exp_scale, comp, hlrange, g) ) +
|
||||
(b < MAXVALF ? hltonecurve[b] : CurveFactory::hlcurve (exp_scale, comp, hlrange, b) ) ) / 3.0;
|
||||
float tonefactor = ((r < MAXVALF ? hltonecurve[r] : CurveFactory::hlcurve(exp_scale, comp, hlrange, r)) +
|
||||
(g < MAXVALF ? hltonecurve[g] : CurveFactory::hlcurve(exp_scale, comp, hlrange, g)) +
|
||||
(b < MAXVALF ? hltonecurve[b] : CurveFactory::hlcurve(exp_scale, comp, hlrange, b))) / 3.0;
|
||||
|
||||
// note: tonefactor includes exposure scaling, that is here exposure slider and highlight compression takes place
|
||||
rtemp[ti * tileSize + tj] = r * tonefactor;
|
||||
@@ -224,9 +235,6 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode c
|
||||
|
||||
for (int i = istart, ti = 0; i < tH; i++, ti++) {
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
rtemp[ti * tileSize + tj] = CLIP<float> (rtemp[ti * tileSize + tj]);
|
||||
gtemp[ti * tileSize + tj] = CLIP<float> (gtemp[ti * tileSize + tj]);
|
||||
btemp[ti * tileSize + tj] = CLIP<float> (btemp[ti * tileSize + tj]);
|
||||
userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]);
|
||||
}
|
||||
}
|
||||
@@ -3260,7 +3268,7 @@ filmlike_clip_rgb_tone (float *r, float *g, float *b, const float L)
|
||||
*b = b_;
|
||||
}
|
||||
|
||||
static void
|
||||
/*static*/ void
|
||||
filmlike_clip (float *r, float *g, float *b)
|
||||
{
|
||||
// This is Adobe's hue-stable film-like curve with a diagonal, ie only used for clipping. Can probably be further optimized.
|
||||
@@ -3670,6 +3678,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
}
|
||||
|
||||
float out_rgbx[4 * TS] ALIGNED16; // Line buffer for CLUT
|
||||
float clutr[TS] ALIGNED16;
|
||||
float clutg[TS] ALIGNED16;
|
||||
float clutb[TS] ALIGNED16;
|
||||
|
||||
LUTu histToneCurveThr;
|
||||
|
||||
@@ -3760,9 +3771,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
filmlike_clip (&r, &g, &b);
|
||||
}
|
||||
|
||||
rtemp[ti * TS + tj] = r;
|
||||
gtemp[ti * TS + tj] = g;
|
||||
btemp[ti * TS + tj] = b;
|
||||
setUnlessOOG(rtemp[ti * TS + tj], r);
|
||||
setUnlessOOG(gtemp[ti * TS + tj], g);
|
||||
setUnlessOOG(btemp[ti * TS + tj], b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3771,30 +3782,43 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
|
||||
//brightness/contrast
|
||||
rtemp[ti * TS + tj] = tonecurve[ rtemp[ti * TS + tj] ];
|
||||
gtemp[ti * TS + tj] = tonecurve[ gtemp[ti * TS + tj] ];
|
||||
btemp[ti * TS + tj] = tonecurve[ btemp[ti * TS + tj] ];
|
||||
float r = tonecurve[ CLIP(rtemp[ti * TS + tj]) ];
|
||||
float g = tonecurve[ CLIP(gtemp[ti * TS + tj]) ];
|
||||
float b = tonecurve[ CLIP(btemp[ti * TS + tj]) ];
|
||||
|
||||
int y = CLIP<int> (lumimulf[0] * Color::gamma2curve[rtemp[ti * TS + tj]] + lumimulf[1] * Color::gamma2curve[gtemp[ti * TS + tj]] + lumimulf[2] * Color::gamma2curve[btemp[ti * TS + tj]]);
|
||||
histToneCurveThr[y >> histToneCurveCompression]++;
|
||||
|
||||
setUnlessOOG(rtemp[ti * TS + tj], r);
|
||||
setUnlessOOG(gtemp[ti * TS + tj], g);
|
||||
setUnlessOOG(btemp[ti * TS + tj], b);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
float tmpr[4];
|
||||
float tmpg[4];
|
||||
float tmpb[4];
|
||||
|
||||
for (int i = istart, ti = 0; i < tH; i++, ti++) {
|
||||
int j = jstart, tj = 0;
|
||||
#ifdef __SSE2__
|
||||
for (; j < tW - 3; j+=4, tj+=4) {
|
||||
//brightness/contrast
|
||||
STVF(rtemp[ti * TS + tj], tonecurve(LVF(rtemp[ti * TS + tj])));
|
||||
STVF(gtemp[ti * TS + tj], tonecurve(LVF(gtemp[ti * TS + tj])));
|
||||
STVF(btemp[ti * TS + tj], tonecurve(LVF(btemp[ti * TS + tj])));
|
||||
STVF(tmpr[0], tonecurve(LVF(rtemp[ti * TS + tj])));
|
||||
STVF(tmpg[0], tonecurve(LVF(gtemp[ti * TS + tj])));
|
||||
STVF(tmpb[0], tonecurve(LVF(btemp[ti * TS + tj])));
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
setUnlessOOG(rtemp[ti * TS + tj + k], tmpr[k]);
|
||||
setUnlessOOG(gtemp[ti * TS + tj + k], tmpg[k]);
|
||||
setUnlessOOG(btemp[ti * TS + tj + k], tmpb[k]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (; j < tW; j++, tj++) {
|
||||
//brightness/contrast
|
||||
rtemp[ti * TS + tj] = tonecurve[rtemp[ti * TS + tj]];
|
||||
gtemp[ti * TS + tj] = tonecurve[gtemp[ti * TS + tj]];
|
||||
btemp[ti * TS + tj] = tonecurve[btemp[ti * TS + tj]];
|
||||
setUnlessOOG(rtemp[ti * TS + tj], tonecurve[rtemp[ti * TS + tj]]);
|
||||
setUnlessOOG(gtemp[ti * TS + tj], tonecurve[gtemp[ti * TS + tj]]);
|
||||
setUnlessOOG(btemp[ti * TS + tj], tonecurve[btemp[ti * TS + tj]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3842,17 +3866,17 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
// individual R tone curve
|
||||
if (rCurve) {
|
||||
rtemp[ti * TS + tj] = rCurve[ rtemp[ti * TS + tj] ];
|
||||
setUnlessOOG(rtemp[ti * TS + tj], rCurve[ rtemp[ti * TS + tj] ]);
|
||||
}
|
||||
|
||||
// individual G tone curve
|
||||
if (gCurve) {
|
||||
gtemp[ti * TS + tj] = gCurve[ gtemp[ti * TS + tj] ];
|
||||
setUnlessOOG(gtemp[ti * TS + tj], gCurve[ gtemp[ti * TS + tj] ]);
|
||||
}
|
||||
|
||||
// individual B tone curve
|
||||
if (bCurve) {
|
||||
btemp[ti * TS + tj] = bCurve[ btemp[ti * TS + tj] ];
|
||||
setUnlessOOG(btemp[ti * TS + tj], bCurve[ btemp[ti * TS + tj] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3919,18 +3943,22 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip, highlight, 0.15f, 0.96f);
|
||||
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
//end of gamut control
|
||||
} else {
|
||||
float x_, y_, z_;
|
||||
//calculate RGB with L_2 and old value of a and b
|
||||
Color::Lab2XYZ (L_2, a_1, b_1, x_, y_, z_) ;
|
||||
Color::xyz2rgb (x_, y_, z_, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip);
|
||||
Color::xyz2rgb (x_, y_, z_, r, g, b, wip);
|
||||
}
|
||||
|
||||
setUnlessOOG(rtemp[ti * TS + tj], r);
|
||||
setUnlessOOG(gtemp[ti * TS + tj], g);
|
||||
setUnlessOOG(btemp[ti * TS + tj], b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4081,9 +4109,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
bo *= preserv;
|
||||
}
|
||||
|
||||
rtemp[ti * TS + tj] = CLIP(ro);
|
||||
gtemp[ti * TS + tj] = CLIP(go);
|
||||
btemp[ti * TS + tj] = CLIP(bo);
|
||||
rtemp[ti * TS + tj] = /*CLIP*/(ro);
|
||||
gtemp[ti * TS + tj] = /*CLIP*/(go);
|
||||
btemp[ti * TS + tj] = /*CLIP*/(bo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4137,9 +4165,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
float b = btemp[ti * TS + tj];
|
||||
float ro, go, bo;
|
||||
labtoning (r, g, b, ro, go, bo, algm, metchrom, twoc, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve, iplow, iphigh, wp, wip);
|
||||
rtemp[ti * TS + tj] = CLIP (ro); //I used CLIP because there is a little bug in gamutLchonly that return 65536.ii intead of 65535 ==> crash
|
||||
gtemp[ti * TS + tj] = CLIP (go);
|
||||
btemp[ti * TS + tj] = CLIP (bo);
|
||||
rtemp[ti * TS + tj] = /*CLIP*/ (ro); //I used CLIP because there is a little bug in gamutLchonly that return 65536.ii intead of 65535 ==> crash
|
||||
gtemp[ti * TS + tj] = /*CLIP*/ (go);
|
||||
btemp[ti * TS + tj] = /*CLIP*/ (bo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4386,28 +4414,32 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
Color::rgbxyz (sourceR, sourceG, sourceB, x, y, z, v_work2xyz);
|
||||
Color::xyz2rgb (x, y, z, sourceR, sourceG, sourceB, v_xyz2clut);
|
||||
|
||||
STVF (rtemp[ti * TS + tj], sourceR);
|
||||
STVF (gtemp[ti * TS + tj], sourceG);
|
||||
STVF (btemp[ti * TS + tj], sourceB);
|
||||
STVF (clutr[tj], sourceR);
|
||||
STVF (clutg[tj], sourceG);
|
||||
STVF (clutb[tj], sourceB);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for (; j < tW; j++, tj++) {
|
||||
float &sourceR = rtemp[ti * TS + tj];
|
||||
float &sourceG = gtemp[ti * TS + tj];
|
||||
float &sourceB = btemp[ti * TS + tj];
|
||||
float sourceR = rtemp[ti * TS + tj];
|
||||
float sourceG = gtemp[ti * TS + tj];
|
||||
float sourceB = btemp[ti * TS + tj];
|
||||
|
||||
float x, y, z;
|
||||
Color::rgbxyz ( sourceR, sourceG, sourceB, x, y, z, wprof );
|
||||
Color::xyz2rgb (x, y, z, sourceR, sourceG, sourceB, xyz2clut);
|
||||
Color::xyz2rgb (x, y, z, clutr[tj], clutg[tj], clutb[tj], xyz2clut);
|
||||
}
|
||||
} else {
|
||||
memcpy(clutr, &rtemp[ti * TS], sizeof(float) * TS);
|
||||
memcpy(clutg, >emp[ti * TS], sizeof(float) * TS);
|
||||
memcpy(clutb, &btemp[ti * TS], sizeof(float) * TS);
|
||||
}
|
||||
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
float &sourceR = rtemp[ti * TS + tj];
|
||||
float &sourceG = gtemp[ti * TS + tj];
|
||||
float &sourceB = btemp[ti * TS + tj];
|
||||
float &sourceR = clutr[tj];
|
||||
float &sourceG = clutg[tj];
|
||||
float &sourceB = clutb[tj];
|
||||
|
||||
// Apply gamma sRGB (default RT)
|
||||
sourceR = Color::gamma_srgbclipped (sourceR);
|
||||
@@ -4415,20 +4447,19 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
sourceB = Color::gamma_srgbclipped (sourceB);
|
||||
}
|
||||
|
||||
const std::size_t line_offset = ti * TS;
|
||||
hald_clut->getRGB (
|
||||
film_simulation_strength,
|
||||
std::min (TS, tW - jstart),
|
||||
rtemp + line_offset,
|
||||
gtemp + line_offset,
|
||||
btemp + line_offset,
|
||||
clutr,
|
||||
clutg,
|
||||
clutb,
|
||||
out_rgbx
|
||||
);
|
||||
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
float &sourceR = rtemp[ti * TS + tj];
|
||||
float &sourceG = gtemp[ti * TS + tj];
|
||||
float &sourceB = btemp[ti * TS + tj];
|
||||
float &sourceR = clutr[tj];
|
||||
float &sourceG = clutg[tj];
|
||||
float &sourceB = clutb[tj];
|
||||
|
||||
// Apply inverse gamma sRGB
|
||||
sourceR = Color::igamma_srgb (out_rgbx[tj * 4 + 0]);
|
||||
@@ -4444,9 +4475,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
#ifdef __SSE2__
|
||||
|
||||
for (; j < tW - 3; j += 4, tj += 4) {
|
||||
vfloat sourceR = LVF (rtemp[ti * TS + tj]);
|
||||
vfloat sourceG = LVF (gtemp[ti * TS + tj]);
|
||||
vfloat sourceB = LVF (btemp[ti * TS + tj]);
|
||||
vfloat sourceR = LVF (clutr[tj]);
|
||||
vfloat sourceG = LVF (clutg[tj]);
|
||||
vfloat sourceB = LVF (clutb[tj]);
|
||||
|
||||
vfloat x;
|
||||
vfloat y;
|
||||
@@ -4454,23 +4485,31 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
Color::rgbxyz (sourceR, sourceG, sourceB, x, y, z, v_clut2xyz);
|
||||
Color::xyz2rgb (x, y, z, sourceR, sourceG, sourceB, v_xyz2work);
|
||||
|
||||
STVF (rtemp[ti * TS + tj], sourceR);
|
||||
STVF (gtemp[ti * TS + tj], sourceG);
|
||||
STVF (btemp[ti * TS + tj], sourceB);
|
||||
STVF (clutr[tj], sourceR);
|
||||
STVF (clutg[tj], sourceG);
|
||||
STVF (clutb[tj], sourceB);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for (; j < tW; j++, tj++) {
|
||||
float &sourceR = rtemp[ti * TS + tj];
|
||||
float &sourceG = gtemp[ti * TS + tj];
|
||||
float &sourceB = btemp[ti * TS + tj];
|
||||
float &sourceR = clutr[tj];
|
||||
float &sourceG = clutg[tj];
|
||||
float &sourceB = clutb[tj];
|
||||
|
||||
float x, y, z;
|
||||
Color::rgbxyz (sourceR, sourceG, sourceB, x, y, z, clut2xyz);
|
||||
Color::xyz2rgb ( x, y, z, sourceR, sourceG, sourceB, wiprof );
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
if (!OOG(rtemp[ti * TS + tj]) || !OOG(gtemp[ti * TS + tj]) || !OOG(btemp[ti * TS + tj])) {
|
||||
rtemp[ti * TS + tj] = clutr[tj];
|
||||
gtemp[ti * TS + tj] = clutg[tj];
|
||||
btemp[ti * TS + tj] = clutb[tj];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4598,7 +4637,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
for (int j = 0; j < tW; j++) {
|
||||
|
||||
//mix channel
|
||||
tmpImage->r (i, j) = tmpImage->g (i, j) = tmpImage->b (i, j) = CLIP ((bwr * tmpImage->r (i, j) + bwg * tmpImage->g (i, j) + bwb * tmpImage->b (i, j)) * kcorec);
|
||||
tmpImage->r (i, j) = tmpImage->g (i, j) = tmpImage->b (i, j) = /*CLIP*/ ((bwr * tmpImage->r (i, j) + bwg * tmpImage->g (i, j) + bwb * tmpImage->b (i, j)) * kcorec);
|
||||
|
||||
#ifndef __SSE2__
|
||||
|
||||
@@ -4694,9 +4733,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
bo *= preserv;
|
||||
}
|
||||
|
||||
tmpImage->r(i, j) = CLIP(ro);
|
||||
tmpImage->g(i, j) = CLIP(go);
|
||||
tmpImage->b(i, j) = CLIP(bo);
|
||||
tmpImage->r(i, j) = /*CLIP*/(ro);
|
||||
tmpImage->g(i, j) = /*CLIP*/(go);
|
||||
tmpImage->b(i, j) = /*CLIP*/(bo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4803,9 +4842,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
float b = tmpImage->b (i, j);
|
||||
float ro, bo, go;
|
||||
labtoning (r, g, b, ro, go, bo, algm, metchrom, twoc, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve, iplow, iphigh, wp, wip);
|
||||
tmpImage->r (i, j) = CLIP (ro);
|
||||
tmpImage->g (i, j) = CLIP (go);
|
||||
tmpImage->b (i, j) = CLIP (bo);
|
||||
tmpImage->r (i, j) = /*CLIP*/ (ro);
|
||||
tmpImage->g (i, j) = /*CLIP*/ (go);
|
||||
tmpImage->b (i, j) = /*CLIP*/ (bo);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5049,9 +5088,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
r += corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5063,9 +5102,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
g += corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
b = CLIP(b);
|
||||
g = CLIP(g);
|
||||
// r = CLIP(r);
|
||||
// b = CLIP(b);
|
||||
// g = CLIP(g);
|
||||
}
|
||||
|
||||
|
||||
@@ -5079,9 +5118,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
b += corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
// mid tones
|
||||
@@ -5112,9 +5151,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
g -= 20000.f * RedM;
|
||||
b -= 20000.f * RedM;
|
||||
}
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5129,9 +5168,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
g += 10000.f * GreenM;
|
||||
b -= 20000.f * GreenM;
|
||||
}
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5146,9 +5185,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
g -= 20000.f * BlueM;
|
||||
b += 10000.f * BlueM;
|
||||
}
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
//high tones
|
||||
@@ -5173,9 +5212,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
b -= corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5188,9 +5227,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
b -= corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5203,9 +5242,9 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
|
||||
g -= corr;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
ro = r;
|
||||
@@ -5262,24 +5301,24 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
|
||||
b -= factor * krl;
|
||||
}
|
||||
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
|
||||
if (kgl > 0.f) {
|
||||
r -= factor * kgl;
|
||||
b -= factor * kgl;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// b = CLIP(b);
|
||||
|
||||
if (kbl > 0.f) {
|
||||
r -= factor * kbl;
|
||||
g -= factor * kbl;
|
||||
}
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
}
|
||||
|
||||
//high tones
|
||||
@@ -5306,9 +5345,9 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
|
||||
g += factor * (kgh > 0.f ? kgh : 0.f);
|
||||
b += factor * (kbh > 0.f ? kbh : 0.f);
|
||||
|
||||
r = CLIP(r);
|
||||
g = CLIP(g);
|
||||
b = CLIP(b);
|
||||
// r = CLIP(r);
|
||||
// g = CLIP(g);
|
||||
// b = CLIP(b);
|
||||
}
|
||||
|
||||
float preserv = 1.f;
|
||||
@@ -5317,9 +5356,9 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
|
||||
preserv = lumbefore / lumafter;
|
||||
}
|
||||
|
||||
ro = CLIP(r * preserv);
|
||||
go = CLIP(g * preserv);
|
||||
bo = CLIP(b * preserv);
|
||||
ro = /*CLIP*/(r * preserv);
|
||||
go = /*CLIP*/(g * preserv);
|
||||
bo = /*CLIP*/(b * preserv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user