Change blend between sharpened, original and blurred, #5075
This commit is contained in:
@@ -180,10 +180,20 @@ BENCHFUN
|
||||
buildBlendMask(luminance, blend, W, H, contrast, sharpenParam.deconvamount / 100.f);
|
||||
JaggedArray<float> blur(W, H);
|
||||
|
||||
if(sharpenParam.blurradius > 0) {
|
||||
if (sharpenParam.blurradius >= 0.25f) {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
{
|
||||
gaussianBlur(tmpI, blur, W, H, sharpenParam.blurradius);
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int i = 0; i < H; ++i) {
|
||||
for (int j = 0; j < W; ++j) {
|
||||
blur[i][j] = intp(blend[i][j], luminance[i][j], std::max(blur[i][j], 0.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const float damping = sharpenParam.deconvdamping / 5.0;
|
||||
@@ -216,7 +226,7 @@ BENCHFUN
|
||||
}
|
||||
}
|
||||
|
||||
if(sharpenParam.blurradius > 0) {
|
||||
if (sharpenParam.blurradius >= 0.25f) {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
@@ -274,20 +284,31 @@ BENCHFUN
|
||||
}
|
||||
}
|
||||
|
||||
JaggedArray<float> blur(W, H);
|
||||
|
||||
if(sharpenParam.blurradius > 0) {
|
||||
#pragma omp parallel
|
||||
{
|
||||
gaussianBlur(lab->L, blur, W, H, sharpenParam.blurradius);
|
||||
}
|
||||
}
|
||||
|
||||
// calculate contrast based blend factors to reduce sharpening in regions with low contrast
|
||||
JaggedArray<float> blend(W, H);
|
||||
float contrast = sharpenParam.contrast / 100.f;
|
||||
buildBlendMask(lab->L, blend, W, H, contrast);
|
||||
|
||||
JaggedArray<float> blur(W, H);
|
||||
|
||||
if (sharpenParam.blurradius >= 0.25f) {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
{
|
||||
gaussianBlur(lab->L, blur, W, H, sharpenParam.blurradius);
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int i = 0; i < H; ++i) {
|
||||
for (int j = 0; j < W; ++j) {
|
||||
blur[i][j] = intp(blend[i][j], lab->L[i][j], std::max(blur[i][j], 0.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
@@ -349,7 +370,8 @@ BENCHFUN
|
||||
|
||||
delete [] b3;
|
||||
}
|
||||
if(sharpenParam.blurradius > 0) {
|
||||
|
||||
if (sharpenParam.blurradius >= 0.25f) {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user