clip negative output of demosaicers to zero, #5561

This commit is contained in:
Ingo Weyrich
2019-12-12 18:45:18 +01:00
parent a2dd906115
commit b2218d05dd
10 changed files with 105 additions and 113 deletions

View File

@@ -90,7 +90,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
}
b = g_mul * cg[j] + b / std::max(1, n);
ab[jx] = b;
ab[jx] = std::max(0.f, b);
} else {
// linear R-G interp. horizontally
float r;
@@ -103,7 +103,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
r = g_mul * cg[j] + (r_mul * rawData[i][j - 1] - g_mul * cg[j - 1] + r_mul * rawData[i][j + 1] - g_mul * cg[j + 1]) / 2;
}
ar[jx] = r;
ar[jx] = std::max(0.f, r);
// linear B-G interp. vertically
float b;
@@ -115,7 +115,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
b = g_mul * cg[j] + (b_mul * rawData[i - 1][j] - g_mul * pg[j] + b_mul * rawData[i + 1][j] - g_mul * ng[j]) / 2;
}
ab[jx] = b;
ab[jx] = std::max(0.f, b);
}
}
} else if(pg && ng) {
@@ -150,7 +150,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
r = g_mul * cg[j] + r / std::max(n, 1);
ar[jx] = r;
ar[jx] = std::max(0.f, r);
} else {
// linear B-G interp. horizontally
float b;
@@ -163,7 +163,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
b = g_mul * cg[j] + (b_mul * rawData[i][j - 1] - g_mul * cg[j - 1] + b_mul * rawData[i][j + 1] - g_mul * cg[j + 1]) / 2;
}
ab[jx] = b;
ab[jx] = std::max(0.f, b);
// linear R-G interp. vertically
float r;
@@ -175,7 +175,7 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D<float> &raw
r = g_mul * cg[j] + (r_mul * rawData[i - 1][j] - g_mul * pg[j] + r_mul * rawData[i + 1][j] - g_mul * ng[j]) / 2;
}
ar[jx] = r;
ar[jx] = std::max(0.f, r);
}
}
}