status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception); /* must be virtual */
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for magick_schedule(static,image->rows/2) shared(status)
+ #pragma omp parallel for schedule(static,4) magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for magick_schedule(static,image->rows/2) shared(status)
+ #pragma omp parallel for schedule(static,4) \
+ magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
texture_view=AcquireVirtualCacheView(texture_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for magick_schedule(static,image->rows/2) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(texture_image,image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Draw sides of ornamental border.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for magick_schedule(static,image->rows/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(image,frame_image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
foreground,
background;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- size_t
- height;
-#endif
-
ssize_t
y;
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,raise_info->height/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) raise_info->height; y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- height=image->rows-2*raise_info->height;
- #pragma omp parallel for schedule(static,height/2) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(image,image,image->rows-2*raise_info->height,1)
#endif
for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- height=image->rows-2*raise_info->height;
- #pragma omp parallel for schedule(static,height/2) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(image,image,image->rows-2*raise_info->height,1)
#endif
for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
{
q=g+(columns+2);
r=p+(y_offset*(columns+2)+x_offset);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) \
+ #pragma omp parallel for schedule(static,4) \
magick_threads(image,image,rows,1)
#endif
for (y=0; y < (ssize_t) rows; y++)
r=q+(y_offset*(columns+2)+x_offset);
s=q-(y_offset*(columns+2)+x_offset);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) \
+ #pragma omp parallel for schedule(static,4) \
magick_threads(image,image,rows,1)
#endif
for (y=0; y < (ssize_t) rows; y++)
image_view=AcquireVirtualCacheView(image,exception);
sample_view=AcquireAuthenticCacheView(sample_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,sample_image->rows/2) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(image,sample_image,1,1)
#endif
for (y=0; y < (ssize_t) sample_image->rows; y++)
{
RectangleInfo
page;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- size_t
- chunk;
-#endif
-
ssize_t
y;
GetPixelCacheTileSize(image,&tile_width,&tile_height);
tile_width=image->columns;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- chunk=image->rows/tile_height/2;
- #pragma omp parallel for magick_schedule(static,chunk) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) \
+ magick_threads(image,image,image->rows/tile_height,1)
#endif
for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
{
Rotate 180 degrees.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for magick_schedule(static,image->rows/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) \
+ magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelCacheTileSize(image,&tile_width,&tile_height);
tile_width=image->columns;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- chunk=image->rows/tile_height/2;
- #pragma omp parallel for magick_schedule(static,chunk) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) \
+ magick_threads(image,image,image->rows/tile_height,1)
#endif
for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
{
Single threaded unless workload justifies the threading overhead.
*/
#define WorkloadThreshold() (16*GetMagickResourceLimit(ThreadResource))
-#define magick_threads(source,destination,rows,expression) \
- if (((rows) > WorkloadThreshold()) && (expression)) \
- num_threads((source) != (destination) ? \
- GetMagickResourceLimit(ThreadResource) : \
- GetImagePixelCacheType(source) != DiskCache ? \
- GetMagickResourceLimit(ThreadResource) : \
- GetMagickResourceLimit(ThreadResource) < 2 ? \
- GetMagickResourceLimit(ThreadResource) : 2)
-#define magick_schedule(type,chunk) \
- schedule(type,(chunk) < 1 ? 1 : (chunk))
+#define magick_threads(source,destination,chunk,expression) \
+ num_threads((expression) == 0 ? 1 : ((chunk) > WorkloadThreshold()) && \
+ (GetImagePixelCacheType(source) != DiskCache) && \
+ (GetImagePixelCacheType(destination) != DiskCache) ? \
+ GetMagickResourceLimit(ThreadResource) : \
+ GetMagickResourceLimit(ThreadResource) < 2 ? 1 : 2)
#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 10))
#define MagickCachePrefetch(address,mode,locality) \
key=(MagickThreadKey) RelinquishMagickMemory(key);
return(MagickTrue);
#endif
-
}
\f
/*
RectangleInfo
extent;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- size_t
- height;
-#endif
-
ssize_t
y;
image_view=AcquireVirtualCacheView(image,exception);
chop_view=AcquireAuthenticCacheView(chop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,extent.y/2) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(image,chop_image,1,1)
#endif
for (y=0; y < (ssize_t) extent.y; y++)
{
Extract chop image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- height=image->rows-(extent.y+extent.height);
- #pragma omp parallel for schedule(static,height/2) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(image,chop_image,1,1)
#endif
for (y=0; y < (ssize_t) (image->rows-(extent.y+extent.height)); y++)
{
image_view=AcquireVirtualCacheView(image,exception);
crop_view=AcquireAuthenticCacheView(crop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,crop_image->rows/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(image,crop_image,1,1)
#endif
for (y=0; y < (ssize_t) crop_image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
flip_view=AcquireAuthenticCacheView(flip_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,flip_image->rows/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(image,flip_image,1,1)
#endif
for (y=0; y < (ssize_t) flip_image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
flop_view=AcquireAuthenticCacheView(flop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,flop_image->rows/2) \
- shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_threads(image,flop_image,1,1)
#endif
for (y=0; y < (ssize_t) flop_image->rows; y++)
{
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
height=source->extent.height-source->extent.y;
- #pragma omp parallel for schedule(static) shared(progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(source_image,destination_image,height,1)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
height=source->extent.height-source->extent.y;
- #pragma omp parallel for schedule(static) shared(progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(source_image,source_image,height,1)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
height=destination->extent.height-destination->extent.y;
- #pragma omp parallel for schedule(static) shared(progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(destination_image,destination_image,height,1)
#endif
for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
height=source->extent.height-source->extent.y;
- #pragma omp parallel for schedule(static) shared(progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(source_image,destination_image,height,1)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
height=source->extent.height-source->extent.y;
- #pragma omp parallel for schedule(static) shared(progress,status) \
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(source_image,source_image,height,1)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)