*spread_image;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
progress=0;
width=GetOptimalKernelWidth1D(radius,0.5);
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
image_view=AcquireCacheView(image);
spread_view=AcquireCacheView(spread_image);
#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) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*noise_image;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
status=MagickTrue;
progress=0;
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
image_view=AcquireCacheView(image);
noise_view=AcquireCacheView(noise_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) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*sketch_image;
MagickBooleanType
+ concurrent,
status;
RandomInfo
return((Image *) NULL);
status=MagickTrue;
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
random_view=AcquireCacheView(random_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) random_image->rows; y++)
{
double
normalize;
+ unsigned long
+ secret_key;
+
unsigned short
protocol_major,
protocol_minor;
random_info->signature_info));
ResetStringInfo(random_info->reservoir);
random_info->normalize=1.0/(~0UL);
- random_info->semaphore=AllocateSemaphoreInfo();
+ random_info->secret_key=random_seed;
random_info->protocol_major=RandomProtocolMajorVersion;
random_info->protocol_minor=RandomProtocolMinorVersion;
+ random_info->semaphore=AllocateSemaphoreInfo();
random_info->timestamp=(ssize_t) time(0);
random_info->signature=MagickSignature;
/*
/*
Seed pseudo random number generator.
*/
- if (random_seed == ~0UL)
+ if (random_info->secret_key == ~0UL)
{
- key=GetRandomKey(random_info,sizeof(random_seed));
+ key=GetRandomKey(random_info,sizeof(random_info->secret_key));
(void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(key),
GetStringInfoLength(key));
key=DestroyStringInfo(key);
*signature_info;
signature_info=AcquireSignatureInfo();
- key=AcquireStringInfo(sizeof(random_seed));
- SetStringInfoDatum(key,(unsigned char *) &random_seed);
- if ((random_seed << 1) > random_seed)
- random_seed<<=1;
- else
- random_seed>>=1;
+ key=AcquireStringInfo(sizeof(random_info->secret_key));
+ SetStringInfoDatum(key,(unsigned char *) &random_info->secret_key);
UpdateSignature(signature_info,key);
key=DestroyStringInfo(key);
FinalizeSignature(signature_info);
% %
% %
% %
+% G e t R a n d o m S e c r e t K e y %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% GetRandomSecretKey() returns the random secet key.
+%
+% The format of the GetRandomSecretKey method is:
+%
+% unsigned long GetRandomSecretKey(const RandomInfo *random_info)
+%
+% A description of each parameter follows:
+%
+% o random_info: the random info.
+*/
+MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info)
+{
+ return(random_info->secret_key);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% G e t R a n d o m V a l u e %
% %
% %
extern MagickExport StringInfo
*GetRandomKey(RandomInfo *,const size_t);
+extern MagickExport unsigned long
+ GetRandomSecretKey(const RandomInfo *);
+
extern MagickExport void
SeedPseudoRandomGenerator(const unsigned long),
SetRandomKey(RandomInfo *,const size_t,unsigned char *),
*evaluate_image;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
status=MagickTrue;
progress=0;
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
evaluate_view=AcquireCacheView(evaluate_image);
if (op == MedianEvaluateOperator)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) evaluate_image->rows; y++)
{
else
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static) shared(progress,status)
+ #pragma omp parallel for schedule(static) shared(progress,status) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) evaluate_image->rows; y++)
{
*image_view;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
return(MagickFalse);
status=MagickTrue;
progress=0;
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
image_view=AcquireCacheView(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) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#define MagickCachePrefetch(address,mode,locality)
#endif
+#define omp_concurrent(concurrent) \
+ num_threads((concurrent) != MagickFalse ? omp_get_max_threads() : 1)
#define omp_throttle(factor) num_threads(omp_get_max_threads() >> \
(factor) == 0 ? 1 : omp_get_max_threads() >> (factor))
flags;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
assert(exception->signature == MagickSignature);
if (thresholds == (const char *) NULL)
return(MagickTrue);
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ return(MagickFalse);
GetPixelInfo(image,&threshold);
min_threshold=0.0;
max_threshold=(MagickRealType) QuantumRange;
*/
status=MagickTrue;
progress=0;
- if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
- return(MagickFalse);
random_info=AcquireRandomInfoThreadSet();
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
image_view=AcquireCacheView(image);
#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) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{