Artifacts when using highlight compression with a threshold of 0, Issue 2621 #14 and #15

This commit is contained in:
Ingo
2015-01-04 16:28:12 +01:00
parent 143230108b
commit 6d30c58758
3 changed files with 3 additions and 29 deletions

View File

@@ -592,7 +592,6 @@ void CurveFactory::curveToningLL ( bool & llctoningutili,const std::vector<doubl
LUTu & outBeforeCCurveHistogram,
ToneCurve & customToneCurve1,
ToneCurve & customToneCurve2,
int skip) {
@@ -675,37 +674,12 @@ void CurveFactory::curveToningLL ( bool & llctoningutili,const std::vector<doubl
hlCurve[i]=exp_scale;
float scalemshoulder = scale - shoulder;
// SSE makes more sense than omp here
#ifdef __SSE2__
int i;
__m128 exp_scalev = _mm_set1_ps(exp_scale);
__m128 scalemshoulderv = _mm_set1_ps(scalemshoulder);
__m128 compv = _mm_set1_ps(comp);
__m128 valv = _mm_set_ps(4.f,3.f,2.f,1.f);
__m128 onev = _mm_set1_ps(1.f);
__m128 fourv = _mm_set1_ps(4.f);
for (i=shoulder+1; i<0xFFFD; i+=4) {
// change to [0,1] range
__m128 Rv = valv*compv/(scalemshoulderv);
_mm_storeu_ps(&hlCurve[i],xlogf(onev+Rv*exp_scalev)/Rv);
valv += fourv;
}
for (; i<0x10000; i++) {
// change to [0,1] range
float val = (float)i-shoulder;
float R = val*comp/(scalemshoulder);
hlCurve[i] = xlogf(1.f+R*exp_scale)/R;
}
#else
for (int i=shoulder+1; i<0x10000; i++) {
// change to [0,1] range
float val = (float)i-shoulder;
float R = val*comp/(scalemshoulder);
hlCurve[i] = xlogf(1.f+R*exp_scale)/R;
hlCurve[i] = xlog(1.0+R*exp_scale)/R; // don't use xlogf or 1.f here. Leads to errors caused by too low precision
}
#endif
}

View File

@@ -36,7 +36,7 @@ ImProcCoordinator::ImProcCoordinator ()
bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(0.), chaut(0.f), redaut(0.f), blueaut(0.f), maxredaut(0.f), maxblueaut(0.f),nresi(0.f),
chromina(0.f), sigma(0.f), lumema(0.f),minredaut(0.f), minblueaut(0.f),
hltonecurve(65536,0),
hltonecurve(65536,LUT_CLIP_BELOW), // used LUT_CLIP_BELOW, because we want to have a baseline of 2^expcomp in this curve. If we don't clip the lut we get wrong values, see Issue 2621 #14 for details
shtonecurve(65536,2),//clip above
tonecurve(65536,0),//,1);

View File

@@ -589,7 +589,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
}
// RGB processing
LUTf curve1 (65536,0);
LUTf curve1 (65536,LUT_CLIP_BELOW); // used LUT_CLIP_BELOW, because we want to have a baseline of 2^expcomp in this curve. If we don't clip the lut we get wrong values, see Issue 2621 #14 for details
LUTf curve2 (65536,0);
LUTf curve (65536,0);
LUTf satcurve (65536,0);