extern "C" {
#endif
+#include <MagickCore/cache.h>
+#include <MagickCore/resource_.h>
#include <MagickCore/thread_.h>
-#define IsConcurrentUno(colors,threshold) \
- if ((colors) > threshold) \
- num_threads(GetMagickResourceLimit(ThreadResource))
-#define IsConcurrentDos(columns,rows,threshold) \
- if (((((columns) > threshold) || ((rows) > threshold))) && \
- ((MagickSizeType) (columns*rows) > (threshold*threshold))) \
- num_threads(GetMagickResourceLimit(ThreadResource))
-#define IsConcurrentTres(columns,rows,expression,threshold) \
- if (((((columns) > threshold) || ((rows) > threshold))) && \
- ((MagickSizeType) (columns*rows) > (threshold*threshold)) && (expression)) \
+/*
+ Single threaded unless workload justifies the threading overhead.
+*/
+#define WorkloadThreshold() (16*GetMagickResourceLimit(ThreadResource))
+#define dynamic_number_threads(image,columns,rows,expression) \
+ if (((((columns) > WorkloadThreshold()) || \
+ ((rows) > WorkloadThreshold()))) && ((MagickSizeType) \
+ ((columns)*(rows)) > (WorkloadThreshold()*WorkloadThreshold())) && \
+ (GetImagePixelCacheType(image) != DiskCache) && (expression)) \
num_threads(GetMagickResourceLimit(ThreadResource))
-#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR > 10))
+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 10))
#define MagickCachePrefetch(address,mode,locality) \
__builtin_prefetch(address,mode,locality)
#else