Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad (Kuzmin) Erium <[email protected]>
  • Loading branch information
ssh4net committed Oct 29, 2024
1 parent 468abcc commit 3ec0c8e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/libOpenImageIO/imagebufalgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ unsharp_impl(ImageBuf& dst, const ImageBuf& blr, const ImageBuf& src,
{
OIIO_DASSERT(dst.spec().nchannels == src.spec().nchannels
&& dst.spec().nchannels == blr.spec().nchannels);
// source + contrast * ((source - blurred) > threshold ? (source - blurred) : 0)
// -> source + (contrast * (source - blurred)) > (threshold * contrast) ? (contrast * (source - blurred) : 0)

ImageBufAlgo::parallel_image(roi, nthreads, [&](ROI roi) {
ImageBuf::ConstIterator<Rtype> s(src, roi);
ImageBuf::ConstIterator<float> b(blr, roi);
for (ImageBuf::Iterator<Rtype> d(dst, roi); !d.done(); ++s, ++d, ++b) {
for (int c = roi.chbegin; c < roi.chend; ++c) {
const float diff = s[c] - b[c];
const float abs_diff = fabsf(diff);
const float diff = s[c] - b[c];
const float abs_diff = std::fabsf(diff);
if (abs_diff > threshold) {
d[c] = s[c] + contrast * diff;
} else {
Expand Down

0 comments on commit 3ec0c8e

Please sign in to comment.