OffsetInfo
offset;
+ register ssize_t
+ i;
+
ssize_t
+ changes[GetOpenMPMaximumThreads()],
y;
size_t
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=MagickTrue;
- changed=0;
progress=0;
image_view=AcquireVirtualCacheView(image,exception);
morphology_view=AcquireAuthenticCacheView(morphology_image,exception);
break;
}
}
+ changed=0;
+ for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ changes[i]=0;
if ((method == ConvolveMorphology) && (kernel->width == 1))
{
+ const int
+ id = GetOpenMPThreadId();
+
register ssize_t
x;
vertical kernels (such as a 'BlurKernel')
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(changed,progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,morphology_image,image->columns,1)
#endif
for (x=0; x < (ssize_t) image->columns; x++)
pixels+=GetPixelChannels(image);
}
}
- #pragma omp critical (MagickCore_MorphologyPrimitive)
if (fabs(pixel-p[center+i]) > MagickEpsilon)
- changed++;
+ changes[id]++;
SetPixelChannel(morphology_image,channel,ClampToQuantum(pixel),
q);
continue;
pixels+=GetPixelChannels(image);
}
}
- #pragma omp critical (MagickCore_MorphologyPrimitive)
if (fabs(pixel-p[center+i]) > MagickEpsilon)
- changed++;
+ changes[id]++;
SetPixelChannel(morphology_image,channel,ClampToQuantum(pixel),q);
}
p+=GetPixelChannels(image);
morphology_image->type=image->type;
morphology_view=DestroyCacheView(morphology_view);
image_view=DestroyCacheView(image_view);
+ for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ changed+=changes[i];
return(status ? (ssize_t) changed : 0);
}
/*
Normal handling of horizontal or rectangular kernels (row by row).
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(changed,progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,morphology_image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
+ const int
+ id = GetOpenMPThreadId();
+
register const Quantum
*restrict p;
default:
break;
}
- #pragma omp critical (MagickCore_MorphologyPrimitive)
if (fabs(pixel-p[center+i]) > MagickEpsilon)
- changed++;
+ changes[id]++;
SetPixelChannel(morphology_image,channel,ClampToQuantum(pixel),q);
}
p+=GetPixelChannels(image);
}
morphology_view=DestroyCacheView(morphology_view);
image_view=DestroyCacheView(image_view);
- return(status ? (ssize_t)changed : -1);
+ for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ changed+=changes[i];
+ return(status ? (ssize_t) changed : -1);
}
/*