CbDL reduce artifacts: wrong preview at low zoom levels, #4407

This commit is contained in:
heckflosse
2018-02-20 14:35:27 +01:00
parent fef8cb475c
commit d677515273
3 changed files with 137 additions and 130 deletions

View File

@@ -60,7 +60,6 @@ void ImProcFunctions::PF_correct_RT(LabImage * src, double radius, int thresh)
const JaggedArray<float> tmpa(width, height);
const JaggedArray<float> tmpb(width, height);
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -482,7 +481,7 @@ void ImProcFunctions::Badpixelscam(CieImage * src, double radius, int thresh, in
//luma badpixels
constexpr float sh_thr = 4.5f; //low value for luma sh_p to avoid artifacts
constexpr float shthr = sh_thr / 24.0f; // divide by 24 because we are using an 5x5 grid and centre point is excluded from summation
constexpr float shthr = sh_thr / 24.0f; // divide by 24 because we are using a 5x5 grid and centre point is excluded from summation
#ifdef _OPENMP
#pragma omp parallel
@@ -886,6 +885,11 @@ void ImProcFunctions::Badpixelscam(CieImage * src, double radius, int thresh, in
void ImProcFunctions::BadpixelsLab(LabImage * src, double radius, int thresh, float chrom)
{
BENCHFUN
if(radius < 0.25) { // for gauss sigma less than 0.25 gaussianblur() just calls memcpy => nothing to do here
return;
}
const int halfwin = ceil(2 * radius) + 1;
const int width = src->W, height = src->H;
@@ -896,17 +900,19 @@ void ImProcFunctions::BadpixelsLab(LabImage * src, double radius, int thresh, fl
std::unique_ptr<float[]> badpix(new float[width * height]);
if(radius >= 0.5) { // for gauss sigma less than 0.25 gaussianblur() just calls memcpy => nothing to do here
#ifdef _OPENMP
#pragma omp parallel
#endif
{
// blur L channel
gaussianBlur(src->L, tmL, width, height, 2.0);//low value to avoid artifacts
gaussianBlur(src->L, tmL, width, height, radius / 2.0);//low value to avoid artifacts
}
//luma badpixels
constexpr float sh_thr = 4.5f;//low value for luma sh_p to avoid artifacts
constexpr float shthr = sh_thr / 24.0f;
//luma badpixels
constexpr float sh_thr = 4.5f; //low value for luma sh_p to avoid artifacts
constexpr float shthr = sh_thr / 24.0f; // divide by 24 because we are using a 5x5 grid and centre point is excluded from summation
#ifdef _OPENMP
#pragma omp parallel
@@ -915,7 +921,7 @@ void ImProcFunctions::BadpixelsLab(LabImage * src, double radius, int thresh, fl
#ifdef __SSE2__
vfloat shthrv = F2V(shthr);
vfloat onev = F2V(1.f);
#endif // __SSE2__
#endif
#ifdef _OPENMP
#pragma omp for
#endif
@@ -1049,8 +1055,9 @@ void ImProcFunctions::BadpixelsLab(LabImage * src, double radius, int thresh, fl
}
}
}
}
// end luma badpixels
// end luma badpixels
float ** tmaa = tmL; // reuse tmL buffer
const JaggedArray<float> tmbb(width, height);

View File

@@ -6285,7 +6285,7 @@ void ImProcFunctions::badpixcam (CieImage* ncie, double rad, int thr, int mode,
}
}
void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, float skinprot, float chrom)
void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, float chrom)
{
if (lab->W >= 8 && lab->H >= 8) {
BadpixelsLab (lab, rad, thr, chrom);
@@ -6300,11 +6300,11 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale)
float t_r = static_cast<float> (params->dirpyrequalizer.hueskin.getTopRight()) / 100.f;
// if (params->dirpyrequalizer.algo=="FI") choice=0;
// else if(params->dirpyrequalizer.algo=="LA") choice=1;
constexpr float artifact = 4.f;
if (params->dirpyrequalizer.gamutlab && params->dirpyrequalizer.skinprotect != 0) {
constexpr float artifact = 4.f;
constexpr float chrom = 50.f;
ImProcFunctions::badpixlab (lab, artifact, 5, params->dirpyrequalizer.skinprotect, chrom); //for artifacts
ImProcFunctions::badpixlab (lab, artifact / scale, 5, chrom); //for artifacts
}
//dirpyrLab_equalizer(lab, lab, params->dirpyrequalizer.mult);

View File

@@ -337,7 +337,7 @@ public:
void defringe (LabImage* lab);
void defringecam (CieImage* ncie);
void badpixcam (CieImage* ncie, double rad, int thr, int mode, float chrom, bool hotbad);
void badpixlab (LabImage* lab, double rad, int thr, float skinprot, float chrom);
void badpixlab (LabImage* lab, double rad, int thr, float chrom);
void PF_correct_RT (LabImage * src, double radius, int thresh);
void PF_correct_RTcam (CieImage * src, double radius, int thresh);