register ssize_t
i;
- if (GetPixelMask(image,p) != 0)
- {
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(threshold_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
- MagickRealType
+ double
mean,
pixel;
if ((traits == UndefinedPixelTrait) ||
(threshold_traits == UndefinedPixelTrait))
continue;
- if ((threshold_traits & CopyPixelTrait) != 0)
+ if (((threshold_traits & CopyPixelTrait) != 0) ||
+ (GetPixelMask(image,p) != 0))
{
SetPixelChannel(threshold_image,channel,p[center+i],q);
continue;
}
pixels+=image->columns*GetPixelChannels(image);
}
- mean=(MagickRealType) (pixel/number_pixels+bias);
- SetPixelChannel(threshold_image,channel,(Quantum) ((MagickRealType)
+ mean=(double) (pixel/number_pixels+bias);
+ SetPixelChannel(threshold_image,channel,(Quantum) ((double)
p[center+i] <= mean ? 0 : QuantumRange),q);
}
p+=GetPixelChannels(image);
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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
}
for (x=0; x < (ssize_t) image->columns; x++)
{
+ double
+ pixel;
+
register ssize_t
i;
q+=GetPixelChannels(image);
continue;
}
+ pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits=GetPixelChannelMapTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
- q[i]=(Quantum) ((MagickRealType) q[i] <= threshold ? 0 : QuantumRange);
+ if (image->channel_mask != DefaultChannels)
+ pixel=(double) q[i];
+ q[i]=(Quantum) (pixel <= threshold ? 0 : QuantumRange);
}
q+=GetPixelChannels(image);
}
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
- (void) TransformImageColorspace(image,sRGBColorspace,exception);
+ (void) TransformImageColorspace(image,RGBColorspace,exception);
GetPixelInfo(image,&threshold);
flags=ParseGeometry(thresholds,&geometry_info);
threshold.red=geometry_info.rho;
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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
}
for (x=0; x < (ssize_t) image->columns; x++)
{
+ double
+ pixel;
+
register ssize_t
i;
q+=GetPixelChannels(image);
continue;
}
+ pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits=GetPixelChannelMapTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
- if ((double) q[i] <= GetPixelInfoChannel(&threshold,channel))
+ if (image->channel_mask != DefaultChannels)
+ pixel=(double) q[i];
+ if (pixel <= GetPixelInfoChannel(&threshold,channel))
q[i]=0;
}
q+=GetPixelChannels(image);
static inline Quantum ClampToUnsignedQuantum(const Quantum quantum)
{
-#if defined(MAGICKCORE_HDRI_SUPPORT)
if (quantum <= 0)
return(0);
if (quantum >= QuantumRange)
return(QuantumRange);
return(quantum);
-#else
- return(quantum);
-#endif
}
MagickExport MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception)
{
+#if !defined(MAGICKCORE_HDRI_SUPPORT)
+ return(MagickTrue);
+#else
#define ClampImageTag "Clamp/Image"
CacheView
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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
}
image_view=DestroyCacheView(image_view);
return(status);
+#endif
}
\f
/*
MagickOffsetType
progress;
- MagickRealType
+ double
levels[CompositePixelChannel];
register ssize_t
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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
threshold=(ssize_t) (QuantumScale*q[i]*(levels[n]*(map->divisor-1)+1));
level=threshold/(map->divisor-1);
threshold-=level*(map->divisor-1);
- q[i]=ClampToQuantum((level+(threshold >=
+ q[i]=ClampToQuantum((double) (level+(threshold >=
map->levels[(x % map->width)+map->width*(y % map->height)]))*
QuantumRange/levels[n]);
n++;
PixelInfo
threshold;
- MagickRealType
+ double
min_threshold,
max_threshold;
return(MagickFalse);
GetPixelInfo(image,&threshold);
min_threshold=0.0;
- max_threshold=(MagickRealType) QuantumRange;
+ max_threshold=(double) QuantumRange;
flags=ParseGeometry(thresholds,&geometry_info);
min_threshold=geometry_info.rho;
max_threshold=geometry_info.sigma;
max_threshold=min_threshold;
if (strchr(thresholds,'%') != (char *) NULL)
{
- max_threshold*=(MagickRealType) (0.01*QuantumRange);
- min_threshold*=(MagickRealType) (0.01*QuantumRange);
+ max_threshold*=(double) (0.01*QuantumRange);
+ min_threshold*=(double) (0.01*QuantumRange);
}
/*
Random threshold image.
key=GetRandomSecretKey(random_info[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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,key == ~0UL)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
}
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
- MagickRealType
+ double
threshold;
PixelChannel
traits=GetPixelChannelMapTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
- if ((MagickRealType) q[i] < min_threshold)
+ if ((double) q[i] < min_threshold)
threshold=min_threshold;
else
- if ((MagickRealType) q[i] > max_threshold)
+ if ((double) q[i] > max_threshold)
threshold=max_threshold;
else
- threshold=(MagickRealType) (QuantumRange*
+ threshold=(double) (QuantumRange*
GetPseudoRandomValue(random_info[id]));
- q[i]=(MagickRealType) q[i] <= threshold ? 0 : QuantumRange;
+ q[i]=(double) q[i] <= threshold ? 0 : QuantumRange;
}
q+=GetPixelChannels(image);
}
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
- (void) TransformImageColorspace(image,sRGBColorspace,exception);
+ (void) TransformImageColorspace(image,RGBColorspace,exception);
GetPixelInfo(image,&threshold);
flags=ParseGeometry(thresholds,&geometry_info);
threshold.red=geometry_info.rho;
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,4) shared(progress,status) \
dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
}
for (x=0; x < (ssize_t) image->columns; x++)
{
+ double
+ pixel;
+
register ssize_t
i;
q+=GetPixelChannels(image);
continue;
}
+ pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits=GetPixelChannelMapTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
- if ((double) q[i] > GetPixelInfoChannel(&threshold,channel))
+ if (image->channel_mask != DefaultChannels)
+ pixel=(double) q[i];
+ if (pixel > GetPixelInfoChannel(&threshold,channel))
q[i]=QuantumRange;
}
q+=GetPixelChannels(image);