color propagation: use up to 4 cores where previously only up to 3 cores were used

This commit is contained in:
Ingo Weyrich
2019-07-09 00:40:25 +02:00
parent 4f73e5bb3c
commit fe43bf1bf2

View File

@@ -617,9 +617,12 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
}
}
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel
#endif
{
#ifdef _OPENMP
#pragma omp for nowait
#endif
for (int c = 0; c < 3; c++) {
@@ -658,11 +661,10 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp single
#endif
{
for (int j = hfw - 2; j > 0; j--) {
for (int i = 2; i < hfh - 2; i++) {
//from right
@@ -698,9 +700,19 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
hilite_dir[4 + 3][i + 2][hfw - 2] += hilite_dir4[3][hfw - 2][i];
}
}
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel
#endif
{
#ifdef _OPENMP
#pragma omp for nowait
#endif
for (int c = 0; c < 3; c++) {
@@ -710,7 +722,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
if (hilite[3][i][j] > epsilon) {
hilite_dir4[c][j][i] = hilite[c][i][j] / hilite[3][i][j];
} else {
hilite_dir4[c][j][i] = 0.1 * ((hilite_dir4[c][(j + 1)][(i - 2)] + hilite_dir4[c][(j + 1)][(i - 1)] + hilite_dir4[c][(j + 1)][(i)] + hilite_dir4[c][(j + 1)][(i + 1)] + hilite_dir4[c][(j + 1)][(i + 2)]) /
hilite_dir4[c][j][i] = 0.1f * ((hilite_dir4[c][(j + 1)][(i - 2)] + hilite_dir4[c][(j + 1)][(i - 1)] + hilite_dir4[c][(j + 1)][(i)] + hilite_dir4[c][(j + 1)][(i + 1)] + hilite_dir4[c][(j + 1)][(i + 2)]) /
(hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)] + epsilon));
}
}
@@ -742,12 +754,10 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp single
#endif
{
for (int i = 1; i < hfh - 1; i++)
for (int j = 2; j < hfw - 2; j++) {
//from top
@@ -763,9 +773,19 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
hilite_dir[4 + 3][hfh - 1][j] += hilite_dir[0 + 3][hfh - 2][j];
}
}
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel
#endif
{
#ifdef _OPENMP
#pragma omp for nowait
#endif
for (int c = 0; c < 3; c++) {
@@ -775,7 +795,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
if (hilite[3][i][j] > epsilon) {
hilite_dir[0 + c][i][j] = hilite[c][i][j] / hilite[3][i][j];
} else {
hilite_dir[0 + c][i][j] = 0.1 * ((hilite_dir[0 + c][i - 1][j - 2] + hilite_dir[0 + c][i - 1][j - 1] + hilite_dir[0 + c][i - 1][j] + hilite_dir[0 + c][i - 1][j + 1] + hilite_dir[0 + c][i - 1][j + 2]) /
hilite_dir[0 + c][i][j] = 0.1f * ((hilite_dir[0 + c][i - 1][j - 2] + hilite_dir[0 + c][i - 1][j - 1] + hilite_dir[0 + c][i - 1][j] + hilite_dir[0 + c][i - 1][j + 1] + hilite_dir[0 + c][i - 1][j + 2]) /
(hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2] + epsilon));
}
}
@@ -788,11 +808,10 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp single
#endif
for (int i = hfh - 2; i > 0; i--)
for (int j = 2; j < hfw - 2; j++) {
//from bottom
@@ -802,6 +821,12 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
hilite_dir[4 + 3][i][j] = (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)]) == 0.f ? 0.f : 0.1f;
}
}
}
if(plistener) {
progress += 0.05;
plistener->setProgress(progress);
}
#ifdef _OPENMP
#pragma omp parallel for
@@ -814,7 +839,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
if (hilite[3][i][j] > epsilon) {
hilite_dir[4 + c][i][j] = hilite[c][i][j] / hilite[3][i][j];
} else {
hilite_dir[4 + c][i][j] = 0.1 * ((hilite_dir[4 + c][(i + 1)][(j - 2)] + hilite_dir[4 + c][(i + 1)][(j - 1)] + hilite_dir[4 + c][(i + 1)][(j)] + hilite_dir[4 + c][(i + 1)][(j + 1)] + hilite_dir[4 + c][(i + 1)][(j + 2)]) /
hilite_dir[4 + c][i][j] = 0.1f * ((hilite_dir[4 + c][(i + 1)][(j - 2)] + hilite_dir[4 + c][(i + 1)][(j - 1)] + hilite_dir[4 + c][(i + 1)][(j)] + hilite_dir[4 + c][(i + 1)][(j + 1)] + hilite_dir[4 + c][(i + 1)][(j + 2)]) /
(hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)] + epsilon));
}
}