status=MagickTrue;
GetPixelInfo(image,&zero);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
current_depth=(size_t *) AcquireQuantumMemory(number_threads,
sizeof(*current_depth));
if (current_depth == (size_t *) NULL)
i;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->colors) > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
depth_map[i]=depth;
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Compute pixel depth.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
i;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
depth_map[i]=ScaleAnyToQuantum(ScaleQuantumToAny((Quantum) i,range),
range);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Scale pixels to desired depth.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/exception.h"
#include "MagickCore/exception-private.h"
#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/thread-private.h"
\f
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
cache_view->image=ReferenceImage((Image *) image);
- cache_view->number_threads=GetOpenMPMaximumThreads();
+ cache_view->number_threads=GetMagickResourceLimit(ThreadResource);
cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
cache_view->debug=IsEventLogging();
cache_info->id=GetMagickThreadId();
cache_info->number_threads=number_threads;
if (number_threads == 0)
- cache_info->number_threads=GetOpenMPMaximumThreads();
+ cache_info->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
cache_info->nexus_info=AcquirePixelCacheNexus(cache_info->number_threads);
if (cache_info->nexus_info == (NexusInfo **) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
clone_offset+=sizeof(Quantum);
}
}
- if (y < clone_info->rows)
+ if (y < (ssize_t) clone_info->rows)
{
/*
Set remaining columns as undefined.
clone_offset+=length;
}
}
- if (y < clone_info->rows)
+ if (y < (ssize_t) clone_info->rows)
{
/*
Set remaining rows as undefined.
(memcmp(p,q,image->number_channels*sizeof(*p)) != 0) ||
(image->metacontent_extent != cache_info->metacontent_extent) ||
(cache_info->nexus_info == (NexusInfo **) NULL) ||
- (cache_info->number_threads < GetOpenMPMaximumThreads()))
+ (cache_info->number_threads < (size_t) GetMagickResourceLimit(ThreadResource)))
return(MagickFalse);
return(MagickTrue);
}
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception); /* must be virtual */
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/monitor-private.h"
#include "MagickCore/option.h"
#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/token.h"
#include "MagickCore/utility.h"
status;
size_t
- height;
+ height,
+ width;
ssize_t
y;
source_view=AcquireVirtualCacheView(source_image,exception);
destination_view=AcquireAuthenticCacheView(destination_image,exception);
height=MagickMin(source_image->rows,destination_image->rows);
+ width=MagickMin(source_image->columns,destination_image->columns);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) height; y++)
{
register ssize_t
x;
- size_t
- width;
-
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(source_view,0,y,source_image->columns,1,
if ((destination_traits == UndefinedPixelTrait) ||
(source_traits == UndefinedPixelTrait))
continue;
- width=MagickMin(source_image->columns,destination_image->columns);
for (x=0; x < (ssize_t) width; x++)
{
if (channel_op == AssignChannelOp)
image_view=AcquireVirtualCacheView(image,exception);
separate_view=AcquireAuthenticCacheView(separate_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SeparateImage)
+ #pragma omp critical (MagickCore_SeparateImage)
#endif
proceed=SetImageProgress(image,SeparateImageTag,progress++,image->rows);
if (proceed == MagickFalse)
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/quantize.h"
#include "MagickCore/quantum.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/string_.h"
#include "MagickCore/token.h"
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Assign index values to colormap entries.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
image->colormap[i].alpha=(double) i;
#include "MagickCore/quantize.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/utility.h"
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
black=pow(10.0,(reference_black-reference_white)*(gamma/density)*
0.002/film_gamma);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
logmap[i]=ScaleMapToQuantum((MagickRealType) (MaxMap*(reference_white+
0.002/film_gamma))/1024.0));
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
G = 0.29900*R+0.58700*G+0.11400*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
G = 0.21260*R+0.71520*G+0.07220*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Mostly removal of a gamma function, but with a linear component
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Z = 0.0193339*R+0.1191920*G+0.9503041*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Linear conversion tables.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
*/
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
return(MagickFalse);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
B = 0.0*R+0.0*G+1.0*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
B = 0.0556434*X-0.2040259*Y+1.057225*Z
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
YCC is scaled by 1.3584. C1 zero is 156 and C2 is at 137.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Linear conversion tables.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
*/
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Convert PseudoClass image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
highlight_view=AcquireAuthenticCacheView(highlight_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q+=GetPixelChannels(reconstruct_image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetAbsoluteError)
+ #pragma omp critical (MagickCore_GetAbsoluteError)
#endif
for (i=0; i <= MaxPixelChannels; i++)
distortion[i]+=channel_distortion[i];
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q+=GetPixelChannels(reconstruct_image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetMeanSquaredError)
+ #pragma omp critical (MagickCore_GetMeanSquaredError)
#endif
for (i=0; i <= MaxPixelChannels; i++)
distortion[i]+=channel_distortion[i];
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q+=GetPixelChannels(reconstruct_image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetMeanAbsoluteError)
+ #pragma omp critical (MagickCore_GetMeanAbsoluteError)
#endif
for (i=0; i <= MaxPixelChannels; i++)
distortion[i]+=channel_distortion[i];
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q+=GetPixelChannels(reconstruct_image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetMeanSquaredError)
+ #pragma omp critical (MagickCore_GetMeanSquaredError)
#endif
for (i=0; i <= MaxPixelChannels; i++)
distortion[i]+=channel_distortion[i];
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q+=GetPixelChannels(reconstruct_image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetPeakAbsoluteError)
+ #pragma omp critical (MagickCore_GetPeakAbsoluteError)
#endif
for (i=0; i <= MaxPixelChannels; i++)
if (channel_distortion[i] > distortion[i])
progress=0;
similarity_view=AcquireAuthenticCacheView(similarity_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) (image->rows-reference->rows+1); y++)
{
similarity=GetSimilarityMetric(image,reference,metric,x,y,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SimilarityImage)
+ #pragma omp critical (MagickCore_SimilarityImage)
#endif
if (similarity < *similarity_metric)
{
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SimilarityImage)
+ #pragma omp critical (MagickCore_SimilarityImage)
#endif
- if (IfMagickFalse( SetImageProgress(image,SimilarityImageTag,
+ if (IfMagickFalse(SetImageProgress(image,SimilarityImageTag,
progress++,image->rows) ))
status=MagickFalse;
}
composite_view=AcquireVirtualCacheView(composite_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_CompositeImage)
+ #pragma omp critical (MagickCore_CompositeImage)
#endif
proceed=SetImageProgress(image,CompositeImageTag,progress++,
image->rows);
composite_view=AcquireVirtualCacheView(composite_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((composite_image->rows*composite_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) composite_image->rows; y++)
{
composite_view=AcquireVirtualCacheView(composite_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Tile texture onto the image background.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) texture_image->rows)
{
texture_view=AcquireVirtualCacheView(texture_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/thread-private.h"
#include "MagickCore/transform.h"
\f
}
if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
(IsPixelInfoGray(&image->matte_color) == MagickFalse))
- SetImageColorspace(frame_image,sRGBColorspace,exception);
+ (void) SetImageColorspace(frame_image,sRGBColorspace,exception);
if ((frame_image->border_color.matte != MagickFalse) &&
(frame_image->matte == MagickFalse))
(void) SetImageAlpha(frame_image,OpaqueAlpha,exception);
Draw sides of ornamental border.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((raise_info->height*raise_info->width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) raise_info->height; y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
{
#include "MagickCore/resample.h"
#include "MagickCore/resample-private.h"
#include "MagickCore/registry.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/shear.h"
#include "MagickCore/string_.h"
UndefinedVirtualPixelMethod,MagickFalse,exception);
distort_view=AcquireAuthenticCacheView(distort_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((distort_image->rows*distort_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (j=0; j < (ssize_t) distort_image->rows; j++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_DistortImage)
+ #pragma omp critical (MagickCore_DistortImage)
#endif
proceed=SetImageProgress(image,DistortImageTag,progress++,
image->rows);
progress=0;
sparse_view=AcquireAuthenticCacheView(sparse_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((sparse_image->rows*sparse_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (j=0; j < (ssize_t) sparse_image->rows; j++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SparseColorImage)
+ #pragma omp critical (MagickCore_SparseColorImage)
#endif
proceed=SetImageProgress(image,SparseColorTag,progress++,image->rows);
if (proceed == MagickFalse)
#include "MagickCore/property.h"
#include "MagickCore/resample.h"
#include "MagickCore/resample-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/thread-private.h"
SegmentInfo
edge;
+ size_t
+ height,
+ width;
+
ssize_t
start,
stop,
GetPixelInfo(image,&zero);
start=(ssize_t) ceil(edge.y1-0.5);
stop=(ssize_t) ceil(edge.y2-0.5);
+ height=(size_t) (floor(edge.y2+0.5)-ceil(edge.y1-0.5));
+ width=(size_t) (floor(edge.x2+0.5)-ceil(edge.x1-0.5));
source_view=AcquireVirtualCacheView(source,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=start; y <= stop; y++)
{
RectangleInfo
bounding_box;
+ size_t
+ height,
+ width;
+
ssize_t
y;
bounding_box=gradient->bounding_box;
status=MagickTrue;
GetPixelInfo(image,&zero);
+ height=bounding_box.height-bounding_box.y;
+ width=bounding_box.width-bounding_box.x;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=bounding_box.y; y < (ssize_t) bounding_box.height; y++)
{
i;
assert(polygon_info != (PolygonInfo **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (polygon_info[i] != (PolygonInfo *) NULL)
polygon_info[i]=DestroyPolygonInfo(polygon_info[i]);
polygon_info=(PolygonInfo **) RelinquishMagickMemory(polygon_info);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
polygon_info=(PolygonInfo **) AcquireQuantumMemory(number_threads,
sizeof(*polygon_info));
if (polygon_info == (PolygonInfo **) NULL)
return((PolygonInfo **) NULL);
- (void) ResetMagickMemory(polygon_info,0,GetOpenMPMaximumThreads()*
- sizeof(*polygon_info));
+ (void) ResetMagickMemory(polygon_info,0,number_threads*sizeof(*polygon_info));
path_info=ConvertPrimitiveToPath(draw_info,primitive_info);
if (path_info == (PathInfo *) NULL)
return(DestroyPolygonThreadSet(polygon_info));
SegmentInfo
bounds;
+ size_t
+ height,
+ width;
+
ssize_t
start,
stop,
image->rows ? (double) image->rows-1.0 : bounds.y2;
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
+ height=(size_t) (floor(bounds.y2+0.5)-ceil(bounds.y1-0.5));
+ width=(size_t) (floor(bounds.x2+0.5)-ceil(bounds.x1-0.5));
if (primitive_info->coordinates == 1)
{
/*
start=(ssize_t) ceil(bounds.y1-0.5);
stop=(ssize_t) floor(bounds.y2+0.5);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=start; y <= stop; y++)
{
start=(ssize_t) ceil(bounds.y1-0.5);
stop=(ssize_t) floor(bounds.y2+0.5);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=start; y <= stop; y++)
{
edge_view=AcquireVirtualCacheView(edge_image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((blur_image->rows*blur_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) blur_image->rows; y++)
{
edge_view=AcquireVirtualCacheView(edge_image,exception);
sharp_view=AcquireAuthenticCacheView(sharp_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((sharp_image->rows*sharp_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) sharp_image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(blur_image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((blur_image->rows*blur_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (x=0; x < (ssize_t) blur_image->columns; x++)
{
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) \
+ if ((rows*columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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) \
+ if ((rows*columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) rows; y++)
{
motion_view=AcquireVirtualCacheView(image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
radial_view=AcquireVirtualCacheView(image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
shade_view=AcquireAuthenticCacheView(shade_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
spread_view=AcquireAuthenticCacheView(spread_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,8) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((image->rows*image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
unsharp_view=AcquireAuthenticCacheView(unsharp_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/quantum-private.h"
#include "MagickCore/resample.h"
#include "MagickCore/resample-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/statistic.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
adjust=(ssize_t) (clut_image->interpolate == IntegerInterpolatePixel ? 0 : 1);
clut_view=AcquireVirtualCacheView(clut_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4)
+ #pragma omp parallel for schedule(static,4) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
clut_view=DestroyCacheView(clut_view);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
continue;
}
GetPixelInfoPixel(image,q,&pixel);
- pixel.red=clut_map[ScaleQuantumToMap(pixel.red)].red;
- pixel.green=clut_map[ScaleQuantumToMap(pixel.green)].green;
- pixel.blue=clut_map[ScaleQuantumToMap(pixel.blue)].blue;
- pixel.black=clut_map[ScaleQuantumToMap(pixel.black)].black;
- pixel.alpha=clut_map[ScaleQuantumToMap(pixel.alpha)].alpha;
+ pixel.red=clut_map[ScaleQuantumToMap(
+ ClampToQuantum(pixel.red))].red;
+ pixel.green=clut_map[ScaleQuantumToMap(
+ ClampToQuantum(pixel.green))].green;
+ pixel.blue=clut_map[ScaleQuantumToMap(
+ ClampToQuantum(pixel.blue))].blue;
+ pixel.black=clut_map[ScaleQuantumToMap(
+ ClampToQuantum(pixel.black))].black;
+ pixel.alpha=clut_map[ScaleQuantumToMap(
+ ClampToQuantum(pixel.alpha))].alpha;
SetPixelInfoPixel(image,&pixel,q);
q+=GetPixelChannels(image);
}
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4)
+ #pragma omp parallel for schedule(static,4) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Apply transfer function to colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*/
number_channels=GetPixelChannels(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) number_channels; i++)
{
sizeof(*stretch_map));
number_channels=GetPixelChannels(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) number_channels; i++)
{
Stretch-contrast colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (j=0; j < (ssize_t) image->colors; j++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
enhance_view=AcquireAuthenticCacheView(enhance_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*/
number_channels=GetPixelChannels(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) number_channels; i++)
{
sizeof(*equalize_map));
number_channels=GetPixelChannels(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) number_channels; i++)
{
Equalize colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (j=0; j < (ssize_t) image->colors; j++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
(void) ResetMagickMemory(gamma_map,0,(MaxMap+1)*sizeof(*gamma_map));
if (gamma != 0.0)
#if defined(MAGICKCORE_OPENMP_SUPPORT) && (MaxMap > 256)
- #pragma omp parallel for
+ #pragma omp parallel for \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
gamma_map[i]=ScaleMapToQuantum((MagickRealType) (MaxMap*pow((double) i/
Gamma-correct colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
hald_view=AcquireVirtualCacheView(hald_image,exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == PseudoClass)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == PseudoClass)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Modulate colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
switch (colorspace)
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Negate colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
if (grayscale != MagickFalse)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Negate image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image->filename);
(void) ResetMagickMemory(sigmoidal_map,0,(MaxMap+1)*sizeof(*sigmoidal_map));
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if (MaxMap > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Sigmoidal-contrast enhance colormap.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/quantize.h"
#include "MagickCore/quantum-private.h"
#include "MagickCore/random_.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/segment.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/signature-private.h"
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
Compute texture features.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((number_grays*number_grays) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < 4; i++)
{
Compute more texture features.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((number_grays*number_grays) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < 4; i++)
{
Compute more texture features.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((number_grays*number_grays) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < 4; i++)
{
(void) ResetMagickMemory(&variance,0,sizeof(variance));
(void) ResetMagickMemory(&sum_squares,0,sizeof(sum_squares));
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((number_grays*number_grays) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < 4; i++)
{
Compute more texture features.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((number_grays*number_grays) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < 4; i++)
{
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/property.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/thread-private.h"
#if defined(MAGICKCORE_FFTW_DELEGATE)
#if defined(MAGICKCORE_HAVE_COMPLEX_H)
key=GetRandomSecretKey(random_info[0]);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((image->rows*image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
shift_view=AcquireAuthenticCacheView(shift_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
colorize_view=AcquireAuthenticCacheView(colorize_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
color_view=AcquireAuthenticCacheView(color_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
i;
assert(fx_info != (FxInfo **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (fx_info[i] != (FxInfo *) NULL)
fx_info[i]=DestroyFxInfo(fx_info[i]);
fx_info=(FxInfo **) RelinquishMagickMemory(fx_info);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
fx_info=(FxInfo **) AcquireQuantumMemory(number_threads,sizeof(*fx_info));
if (fx_info == (FxInfo **) NULL)
return((FxInfo **) NULL);
image_view=AcquireVirtualCacheView(image,exception);
fx_view=AcquireAuthenticCacheView(fx_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) fx_image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
implode_view=AcquireAuthenticCacheView(implode_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(morph_image,exception);
morph_view=AcquireAuthenticCacheView(morph_images,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((morph_image->rows*morph_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) morph_images->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
sepia_view=AcquireAuthenticCacheView(sepia_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
random_view=AcquireAuthenticCacheView(random_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((image->rows*image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) random_image->rows; y++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
swirl_view=AcquireAuthenticCacheView(swirl_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
tint_view=AcquireAuthenticCacheView(tint_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
(void) SetCacheViewVirtualPixelMethod(image_view,
BackgroundVirtualPixelMethod);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) wave_image->rows; y++)
{
-/*
+ /*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
CacheView
*view;
- size_t
- number_threads;
-
ExceptionInfo
*exception;
clone_view->description=ConstantString(image_view->description);
clone_view->extent=image_view->extent;
clone_view->view=CloneCacheView(image_view->view);
- clone_view->number_threads=image_view->number_threads;
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,image_view->exception);
clone_view->debug=image_view->debug;
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_DuplexTransferImageViewIterator)
+ #pragma omp critical (MagickCore_DuplexTransferImageViewIterator)
#endif
proceed=SetImageProgress(source_image,source->description,progress++,
source->extent.height);
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
source_image=source->image;
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((width*height) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetImageViewIterator)
+ #pragma omp critical (MagickCore_GetImageViewIterator)
#endif
proceed=SetImageProgress(source_image,source->description,progress++,
source->extent.height);
image_view->extent.height=image->rows;
image_view->extent.x=0;
image_view->extent.y=0;
- image_view->number_threads=GetOpenMPMaximumThreads();
image_view->exception=AcquireExceptionInfo();
image_view->debug=IsEventLogging();
image_view->signature=MagickSignature;
image_view->extent.height=height;
image_view->extent.x=x;
image_view->extent.y=y;
- image_view->number_threads=GetOpenMPMaximumThreads();
image_view->exception=AcquireExceptionInfo();
image_view->debug=IsEventLogging();
image_view->signature=MagickSignature;
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=destination->extent.height-destination->extent.y;
+ width=destination->extent.width-destination->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(destination->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SetImageViewIterator)
+ #pragma omp critical (MagickCore_SetImageViewIterator)
#endif
proceed=SetImageProgress(destination_image,destination->description,
progress++,destination->extent.height);
% %
% %
% %
-% S e t I m a g e V i e w T h r e a d s %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% SetImageViewThreads() sets the number of threads in a thread team.
-%
-% The format of the SetImageViewDescription method is:
-%
-% void SetImageViewThreads(ImageView *image_view,
-% const size_t number_threads)
-%
-% A description of each parameter follows:
-%
-% o image_view: the image view.
-%
-% o number_threads: the number of threads in a thread team.
-%
-*/
-MagickExport void SetImageViewThreads(ImageView *image_view,
- const size_t number_threads)
-{
- assert(image_view != (ImageView *) NULL);
- assert(image_view->signature == MagickSignature);
- image_view->number_threads=number_threads;
- if (number_threads > GetOpenMPMaximumThreads())
- image_view->number_threads=GetOpenMPMaximumThreads();
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% T r a n s f e r I m a g e V i e w I t e r a t o r %
% %
% %
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_TransferImageViewIterator)
+ #pragma omp critical (MagickCore_TransferImageViewIterator)
#endif
proceed=SetImageProgress(source_image,source->description,progress++,
source->extent.height);
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_UpdateImageViewIterator)
+ #pragma omp critical (MagickCore_UpdateImageViewIterator)
#endif
proceed=SetImageProgress(source_image,source->description,progress++,
source->extent.height);
#include "MagickCore/property.h"
#include "MagickCore/quantize.h"
#include "MagickCore/random_.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/segment.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/signature-private.h"
y_offset-=geometry.y;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
break;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
break;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static,4) shared(range_exception,status)
+ #pragma omp parallel for schedule(static,4) shared(range_exception,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/prepress.h"
#include "MagickCore/quantize.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/registry.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/splay-tree.h"
x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
-#pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (x=0; x < (ssize_t) image->columns; x++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_MorphologyImage)
+ #pragma omp critical (MagickCore_MorphologyImage)
#endif
proceed=SetImageProgress(image,MorphologyTag,progress++,image->rows);
if (proceed == MagickFalse)
** Normal handling of horizontal or rectangular kernels (row by row)
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_MorphologyImage)
+ #pragma omp critical (MagickCore_MorphologyImage)
#endif
proceed=SetImageProgress(image,MorphologyTag,progress++,image->rows);
if (proceed == MagickFalse)
const char *geometry)
{
//GeometryFlags
- int
+ MagickStatusType
flags;
+
GeometryInfo
args;
#include "MagickCore/monitor-private.h"
#include "MagickCore/paint.h"
#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/statistic.h"
#include "MagickCore/string_.h"
#include "MagickCore/thread-private.h"
i;
assert(histogram != (size_t **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (histogram[i] != (size_t *) NULL)
histogram[i]=(size_t *) RelinquishMagickMemory(histogram[i]);
histogram=(size_t **) RelinquishMagickMemory(histogram);
**histogram,
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
histogram=(size_t **) AcquireQuantumMemory(number_threads,sizeof(*histogram));
if (histogram == (size_t **) NULL)
return((size_t **) NULL);
image_view=AcquireVirtualCacheView(image,exception);
paint_view=AcquireAuthenticCacheView(paint_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "MagickCore/memory_.h"
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/prepress.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/registry.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/splay-tree.h"
total_ink_density=0.0;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelBlue(image,p)+GetPixelBlack(image,p);
if (density > total_ink_density)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GetImageTotalInkDensity)
+ #pragma omp critical (MagickCore_GetImageTotalInkDensity)
#endif
{
if (density > total_ink_density)
#include "MagickCore/property.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/splay-tree.h"
#include "MagickCore/string_.h"
#include "MagickCore/thread-private.h"
i;
assert(pixels != (unsigned short **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (pixels[i] != (unsigned short *) NULL)
pixels[i]=(unsigned short *) RelinquishMagickMemory(pixels[i]);
pixels=(unsigned short **) RelinquishMagickMemory(pixels);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=GetMagickResourceLimit(ThreadResource);
pixels=(unsigned short **) AcquireQuantumMemory(number_threads,
sizeof(*pixels));
if (pixels == (unsigned short **) NULL)
i;
assert(transform != (cmsHTRANSFORM *) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (transform[i] != (cmsHTRANSFORM) NULL)
cmsDeleteTransform(transform[i]);
transform=(cmsHTRANSFORM *) RelinquishMagickMemory(transform);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=GetMagickResourceLimit(ThreadResource);
transform=(cmsHTRANSFORM *) AcquireQuantumMemory(number_threads,
sizeof(*transform));
if (transform == (cmsHTRANSFORM *) NULL)
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
-#pragma omp critical (MagickCore_ProfileImage)
+ #pragma omp critical (MagickCore_ProfileImage)
#endif
proceed=SetImageProgress(image,ProfileImageTag,progress++,
image->rows);
#include "MagickCore/quantize.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/thread-private.h"
\f
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
i;
assert(pixels != (RealPixelInfo **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (pixels[i] != (RealPixelInfo *) NULL)
pixels[i]=(RealPixelInfo *) RelinquishMagickMemory(pixels[i]);
pixels=(RealPixelInfo **) RelinquishMagickMemory(pixels);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(RealPixelInfo **) AcquireQuantumMemory(number_threads,
sizeof(*pixels));
if (pixels == (RealPixelInfo **) NULL)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == PseudoClass)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (image->colors > 256) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
if (colormap_index[intensity] < 0)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_SetGrayscaleImage)
+ #pragma omp critical (MagickCore_SetGrayscaleImage)
#endif
if (colormap_index[intensity] < 0)
{
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
assert(quantum_info != (QuantumInfo *) NULL);
assert(quantum_info->signature == MagickSignature);
- quantum_info->number_threads=GetOpenMPMaximumThreads();
+ quantum_info->number_threads=GetMagickResourceLimit(ThreadResource);
quantum_info->pixels=(unsigned char **) AcquireQuantumMemory(
quantum_info->number_threads,sizeof(*quantum_info->pixels));
if (quantum_info->pixels == (unsigned char **) NULL)
#include "MagickCore/resample.h"
#include "MagickCore/resize.h"
#include "MagickCore/resize-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/token.h"
#include "MagickCore/transform.h"
#include "MagickCore/signature-private.h"
#include "MagickCore/resample-private.h"
#include "MagickCore/resize.h"
#include "MagickCore/resize-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/thread-private.h"
/* Define coefficents for Gaussian */
resize_filter->coefficient[0]=value; /* note sigma too */
resize_filter->coefficient[1]=1.0/(2.0*value*value); /* sigma scaling */
- resize_filter->coefficient[2]=1.0/(Magick2PI*value*value);
+ resize_filter->coefficient[2]=(MagickRealType)
+ (1.0/(Magick2PI*value*value));
/* normalization - not actually needed or used! */
if ( value > 0.5 )
resize_filter->support *= value/0.5; /* increase support */
scale.x=(double) image->columns/resize_image->columns;
scale.y=(double) image->rows/resize_image->rows;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((resize_image->rows*resize_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) resize_image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_InterpolativeResizeImage)
+ #pragma omp critical (MagickCore_InterpolativeResizeImage)
#endif
proceed=SetImageProgress(image,InterpolativeResizeImageTag,progress++,
image->rows);
i;
assert(contribution != (ContributionInfo **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (contribution[i] != (ContributionInfo *) NULL)
contribution[i]=(ContributionInfo *) RelinquishAlignedMemory(
contribution[i]);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
contribution=(ContributionInfo **) AcquireQuantumMemory(number_threads,
sizeof(*contribution));
if (contribution == (ContributionInfo **) NULL)
image_view=AcquireVirtualCacheView(image,exception);
resize_view=AcquireAuthenticCacheView(resize_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((resize_image->rows*resize_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (x=0; x < (ssize_t) resize_image->columns; x++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_HorizontalFilter)
+ #pragma omp critical (MagickCore_HorizontalFilter)
#endif
proceed=SetImageProgress(image,ResizeImageTag,(*offset)++,span);
if( IfMagickFalse(proceed) )
image_view=AcquireVirtualCacheView(image,exception);
resize_view=AcquireAuthenticCacheView(resize_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) resize_image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_VerticalFilter)
+ #pragma omp critical (MagickCore_VerticalFilter)
#endif
proceed=SetImageProgress(image,ResizeImageTag,(*offset)++,span);
if( IfMagickFalse(proceed) )
image_view=AcquireVirtualCacheView(image,exception);
sample_view=AcquireAuthenticCacheView(sample_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((sample_image->rows*sample_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) sample_image->rows; y++)
{
if (value != (char *) NULL)
resource_info.thread_limit=MagickMin(limit,StringToSizeType(value,
100.0));
- SetOpenMPMaximumThreads((int) resource_info.thread_limit);
break;
}
case TimeResource:
#include "MagickCore/quantize.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/segment.h"
#include "MagickCore/string_.h"
\f
*/
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
q=swap;
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4)
+ #pragma omp parallel for schedule(static,4) \
+ if ((p->width*p->height) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (x=0; x < (ssize_t) p->width; x++)
{
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
RadonProjection(source_cells,destination_cells,-1,projection);
(void) ResetRadonCells(source_cells);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*/
GetPixelCacheTileSize(image,&tile_width,&tile_height);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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 schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*/
GetPixelCacheTileSize(image,&tile_width,&tile_height);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) height; y++)
{
background=image->background_color;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (x=0; x < (ssize_t) width; x++)
{
i;
assert(pixels != (PixelChannels **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (pixels[i] != (PixelChannels *) NULL)
pixels[i]=(PixelChannels *) RelinquishMagickMemory(pixels[i]);
pixels=(PixelChannels **) RelinquishMagickMemory(pixels);
length,
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(PixelChannels **) AcquireQuantumMemory(number_threads,
sizeof(*pixels));
if (pixels == (PixelChannels **) NULL)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((evaluate_image->rows*evaluate_image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) evaluate_image->rows; y++)
{
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((evaluate_image->rows*evaluate_image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) evaluate_image->rows; y++)
{
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((image->rows*image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_EvaluateImage)
+ #pragma omp critical (MagickCore_EvaluateImage)
#endif
proceed=SetImageProgress(image,EvaluateImageTag,progress++,image->rows);
if (proceed == MagickFalse)
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_FunctionImage)
+ #pragma omp critical (MagickCore_FunctionImage)
#endif
proceed=SetImageProgress(image,FunctionImageTag,progress++,image->rows);
if (proceed == MagickFalse)
sum_fourth_power=0.0;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*minima=MagickHuge;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
i;
assert(pixel_list != (PixelList **) NULL);
- for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (pixel_list[i] != (PixelList *) NULL)
pixel_list[i]=DestroyPixelList(pixel_list[i]);
pixel_list=(PixelList **) RelinquishMagickMemory(pixel_list);
size_t
number_threads;
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixel_list=(PixelList **) AcquireQuantumMemory(number_threads,
sizeof(*pixel_list));
if (pixel_list == (PixelList **) NULL)
image_view=AcquireVirtualCacheView(image,exception);
statistic_view=AcquireAuthenticCacheView(statistic_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((statistic_image->rows*statistic_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) statistic_image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_StatisticImage)
+ #pragma omp critical (MagickCore_StatisticImage)
#endif
proceed=SetImageProgress(image,StatisticImageTag,progress++,
image->rows);
#define MagickCachePrefetch(address,mode,locality)
#endif
-#define omp_throttle(factor) num_threads(omp_get_max_threads() >> \
- (factor) == 0 ? 1 : omp_get_max_threads() >> (factor))
-
#if defined(MAGICKCORE_THREAD_SUPPORT)
typedef pthread_mutex_t MagickMutexType;
#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
*/
static inline size_t GetOpenMPMaximumThreads(void)
{
- static size_t
- maximum_threads = 1;
-
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- {
- ssize_t
- threads;
-
- threads=omp_get_max_threads();
- if (threads > (ssize_t) maximum_threads)
- maximum_threads=threads;
- }
+ return(omp_get_max_threads());
+#else
+ return(1);
#endif
- return(maximum_threads);
}
static inline int GetOpenMPThreadId(void)
image_view=AcquireVirtualCacheView(image,exception);
threshold_view=AcquireAuthenticCacheView(threshold_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_AdaptiveThresholdImage)
+ #pragma omp critical (MagickCore_AdaptiveThresholdImage)
#endif
proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress++,
image->rows);
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_BilevelImage)
+ #pragma omp critical (MagickCore_BilevelImage)
#endif
proceed=SetImageProgress(image,ThresholdImageTag,progress++,
image->rows);
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ClampImage)
+ #pragma omp critical (MagickCore_ClampImage)
#endif
proceed=SetImageProgress(image,ClampImageTag,progress++,
image->rows);
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
-#pragma omp critical (MagickCore_OrderedPosterizeImage)
+ #pragma omp critical (MagickCore_OrderedPosterizeImage)
#endif
proceed=SetImageProgress(image,DitherImageTag,progress++,image->rows);
if (proceed == MagickFalse)
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,8) shared(progress,status) \
- if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
+ if (((image->rows*image->columns) > 8192) && (key == ~0UL)) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_RandomThresholdImage)
+ #pragma omp critical (MagickCore_RandomThresholdImage)
#endif
proceed=SetImageProgress(image,ThresholdImageTag,progress++,
image->rows);
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
chop_view=AcquireAuthenticCacheView(chop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((extent.y*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) extent.y; y++)
{
Extract chop image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((crop_image->rows*crop_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) crop_image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
excerpt_view=AcquireAuthenticCacheView(excerpt_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((excerpt_image->rows*excerpt_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) excerpt_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) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((flip_image->rows*flip_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#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) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((flop_image->rows*flop_image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) flop_image->rows; y++)
{
source_view=AcquireVirtualCacheView(source,exception);
destination_view=AcquireAuthenticCacheView(destination,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(status)
+ #pragma omp parallel for schedule(static) shared(status) \
+ if ((rows*columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
splice_view=AcquireAuthenticCacheView(splice_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((splice_geometry.y*splice_geometry.x) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) splice_geometry.y; y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((splice_geometry.y*splice_geometry.x) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);
y < (ssize_t) splice_image->rows; y++)
image_view=AcquireVirtualCacheView(image,exception);
transpose_view=AcquireAuthenticCacheView(transpose_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
image_view=AcquireVirtualCacheView(image,exception);
transverse_view=AcquireAuthenticCacheView(transverse_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
return(status);
}
- number_threads=GetOpenMPMaximumThreads();
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
serial=0.0;
for (n=1; n <= (ssize_t) number_threads; n++)
{
CacheView
*view;
- size_t
- number_threads;
-
PixelWand
***pixel_wands;
wand_view->exception);
clone_view->view=CloneCacheView(wand_view->view);
clone_view->extent=wand_view->extent;
- clone_view->number_threads=wand_view->number_threads;
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,wand_view->exception);
- for (i=0; i < (ssize_t) wand_view->number_threads; i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
wand_view->pixel_wands[i],wand_view->extent.width);
clone_view->debug=wand_view->debug;
*/
static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands,
- const size_t number_wands,const size_t number_threads)
+ const size_t number_wands)
{
register ssize_t
i;
assert(pixel_wands != (PixelWand ***) NULL);
- for (i=0; i < (ssize_t) number_threads; i++)
+ for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
if (pixel_wands[i] != (PixelWand **) NULL)
pixel_wands[i]=DestroyPixelWands(pixel_wands[i],number_wands);
pixel_wands=(PixelWand ***) RelinquishMagickMemory(pixel_wands);
assert(wand_view != (WandView *) NULL);
assert(wand_view->signature == WandSignature);
wand_view->pixel_wands=DestroyPixelsThreadSet(wand_view->pixel_wands,
- wand_view->extent.width,wand_view->number_threads);
+ wand_view->extent.width);
wand_view->image=DestroyImage(wand_view->image);
wand_view->view=DestroyCacheView(wand_view->view);
wand_view->exception=DestroyExceptionInfo(wand_view->exception);
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
source_image=source->wand->images;
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
%
*/
-static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands,
- const size_t number_threads)
+static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands)
{
PixelWand
***pixel_wands;
register ssize_t
i;
+ size_t
+ number_threads;
+
+ number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixel_wands=(PixelWand ***) AcquireQuantumMemory(number_threads,
sizeof(*pixel_wands));
if (pixel_wands == (PixelWand ***) NULL)
{
pixel_wands[i]=NewPixelWands(number_wands);
if (pixel_wands[i] == (PixelWand **) NULL)
- return(DestroyPixelsThreadSet(pixel_wands,number_wands,number_threads));
+ return(DestroyPixelsThreadSet(pixel_wands,number_wands));
}
return(pixel_wands);
}
wand_view->view=AcquireVirtualCacheView(wand_view->wand->images,exception);
wand_view->extent.width=wand->images->columns;
wand_view->extent.height=wand->images->rows;
- wand_view->number_threads=GetOpenMPMaximumThreads();
- wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
- wand_view->number_threads);
+ wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width);
wand_view->exception=exception;
if (wand_view->pixel_wands == (PixelWand ***) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
wand_view->extent.height=height;
wand_view->extent.x=x;
wand_view->extent.y=y;
- wand_view->number_threads=GetOpenMPMaximumThreads();
wand_view->exception=exception;
- wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
- wand_view->number_threads);
+ wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width);
if (wand_view->pixel_wands == (PixelWand ***) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=destination->extent.height-destination->extent.y;
+ width=destination->extent.width-destination->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(destination->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
{
% %
% %
% %
-% S e t W a n d V i e w T h r e a d s %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% SetWandViewThreads() sets the number of threads in a thread team.
-%
-% The format of the SetWandViewDescription method is:
-%
-% void SetWandViewThreads(WandView *image_view,
-% const size_t number_threads)
-%
-% A description of each parameter follows:
-%
-% o image_view: the image view.
-%
-% o number_threads: the number of threads in a thread team.
-%
-*/
-MagickExport void SetWandViewThreads(WandView *image_view,
- const size_t number_threads)
-{
- assert(image_view != (WandView *) NULL);
- assert(image_view->signature == MagickSignature);
- image_view->number_threads=number_threads;
- if (number_threads > GetOpenMPMaximumThreads())
- image_view->number_threads=GetOpenMPMaximumThreads();
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% T r a n s f e r W a n d V i e w I t e r a t o r %
% %
% %
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
MagickOffsetType
progress;
+ size_t
+ height,
+ width;
+
ssize_t
y;
return(MagickFalse);
status=MagickTrue;
progress=0;
+ height=source->extent.height-source->extent.y;
+ width=source->extent.width-source->extent.x;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status) num_threads(source->number_threads)
+ #pragma omp parallel for schedule(static) shared(progress,status) \
+ if ((height*width) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
#include "MagickCore/monitor-private.h"
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/static.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
image->columns=(size_t) (level*cube_size);
image->rows=(size_t) (level*cube_size);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(status)
+ #pragma omp parallel for schedule(static,8) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) level)
{
<delegate decode="https" command=""curl" -s -k -o "%o" "https:%M""/>
<delegate decode="ilbm" command=""ilbmtoppm" "%i" > "%o""/>
<delegate decode="man" command=""groff" -man -Tps "%i" > "%o""/>
- <delegate decode="mpeg:decode" command=""ffmpeg" -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z""/>
+ <delegate decode="mpeg:decode" command=""ffmpeg" -v -1 -i "%i" -vframes %S -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z""/>
<delegate encode="mpeg:encode" stealth="True" command=""ffmpeg" -v -1 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 300 -i "%M%%d.jpg" "%u.%m" 2> "%Z""/>
<delegate decode="sid" command=""mrsidgeodecode" -if sid -i "%i" -of tif -o "%o" > "%u""/>
<delegate decode="pcl:color" stealth="True" command=""pcl6" -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=ppmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "%s""/>
<delegate decode="pdf" encode="ps" mode="bi" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pswrite" "-sOutputFile=%o" "-f%i""/>
<delegate decode="tiff" encode="launch" mode="encode" command=""gimp" "%i""/>
<delegate decode="pnm" encode="ilbm" mode="encode" command=""ppmtoilbm" -24if "%i" > "%o""/>
- <delegate decode="pov" command=""povray" "+i%i" -D0 "+o%o" +fn%q +w%w +h%h +a -q9 -kfi%s -kff%n\n"convert" -concatenate "%o*.png" "%o""/>
+ <delegate decode="pov" command=""povray" "+i%i" -D0 "+o%o" +fn%q +w%w +h%h +a -q9 "-kfi%s" "-kff%n";"convert" -concatenate "%o*.png" "%o""/>
<delegate decode="ps" encode="eps" mode="bi" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=epswrite" "-sOutputFile=%o" "-f%i""/>
<delegate decode="ps" encode="pdf" mode="bi" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pdfwrite" "-sOutputFile=%o" "-f%i""/>
<delegate decode="ps" encode="print" mode="encode" command="lpr "%i""/>
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if ((image->rows*image->columns) > 8192) \
+ num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{