#include "MagickCore/annotate.h"
#include "MagickCore/annotate-private.h"
#include "MagickCore/attribute.h"
+#include "MagickCore/cache-private.h"
#include "MagickCore/cache-view.h"
#include "MagickCore/channel.h"
#include "MagickCore/client.h"
if (annotate_info->dash_pattern != (double *) NULL)
annotate_info->dash_pattern[0]=0.0;
(void) CloneString(&annotate_info->primitive,"path '");
+ status=MagickTrue;
if (draw_info->render != MagickFalse)
{
+ status=SyncImagePixelCache(image,exception);
if (image->storage_class != DirectClass)
(void) SetImageStorageClass(image,DirectClass,exception);
if (image->alpha_trait == UndefinedPixelTrait)
if (utf8 != (unsigned char *) NULL)
p=(char *) utf8;
}
- status=MagickTrue;
grapheme=(GraphemeInfo *) NULL;
length=ComplexTextLayout(image,draw_info,p,strlen(p),face,flags,&grapheme,
exception);
#include "MagickCore/artifact.h"
#include "MagickCore/blob.h"
#include "MagickCore/cache.h"
+#include "MagickCore/cache-private.h"
#include "MagickCore/cache-view.h"
#include "MagickCore/channel.h"
#include "MagickCore/color.h"
draw_info->affine.rx,draw_info->affine.ry,draw_info->affine.sy,
draw_info->affine.tx,draw_info->affine.ty);
}
+ if (SyncImagePixelCache(image,exception) == MagickFalse)
+ return(MagickFalse);
if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
((IsPixelInfoGray(&draw_info->fill) == MagickFalse) ||
(IsPixelInfoGray(&draw_info->stroke) == MagickFalse)))
kuwahara_image=DestroyImage(kuwahara_image);
return(kuwahara_image);
}
-
+\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% The format of the LocalContrastImage method is:
%
% Image *LocalContrastImage(const Image *image, const double radius,
-% const double strength, ExceptionInfo *exception)
+% const double strength,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
ssize_t
scanLineSize,
- thread_count,
width;
/*
}
image_view=AcquireVirtualCacheView(image,exception);
contrast_view=AcquireAuthenticCacheView(contrast_image,exception);
- thread_count=1;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel magick_threads(image,image,image->rows,1)
- {
- #pragma omp single
- {
- thread_count=omp_get_num_threads();
- }
- }
-#endif
scanLineSize=(ssize_t) MagickMax(image->columns,image->rows);
width=(ssize_t) scanLineSize*0.002f*fabs(radius);
scanLineSize+=(2*width);
- scanLinePixels_info=AcquireVirtualMemory((size_t) thread_count*
+ scanLinePixels_info=AcquireVirtualMemory((size_t) GetOpenMPMaximumThreads()*
scanLineSize,sizeof(*scanLinePixels));
if (scanLinePixels_info == (MemoryInfo *) NULL)
{
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
}
scanLinePixels=(float *) GetVirtualMemoryBlob(scanLinePixels_info);
- /* Create intermediate buffer */
+ /*
+ Create intermediate buffer.
+ */
interImage_info=AcquireVirtualMemory(image->rows*(image->columns+(2*width)),
sizeof(*interImage));
if (interImage_info == (MemoryInfo *) NULL)
}
interImage=(float *) GetVirtualMemoryBlob(interImage_info);
totalWeight=(float) ((width+1)*(width+1));
-
- /* Vertical Pass */
+ /*
+ Vertical pass.
+ */
{
ssize_t
x;
#endif
for (x=0; x < (ssize_t) image->columns; x++)
{
+ const int
+ id = GetOpenMPThreadId();
+
const Quantum
*magick_restrict p;
i;
pixels=scanLinePixels;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- pixels+=scanLineSize*omp_get_thread_num();
-#endif
+ pixels+=id*scanLineSize;
pix=pixels;
p=GetCacheViewVirtualPixels(image_view,x,-width,1,image->rows+(2*width),
exception);
-
for (y=0; y < (ssize_t) image->rows+(2*width); y++)
{
*pix++=(float)GetPixelLuma(image,p);
p+=image->number_channels;
}
-
out=interImage+x+width;
-
- for (y = 0; y < (ssize_t) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
float
sum,
if ((x > (ssize_t) image->columns-width-2) &&
(x != (ssize_t) image->columns-1))
*(out+((image->columns-x-1)*2))=*out;
-
out+=image->columns+(width*2);
}
}
}
- /* Horizontal Pass */
+ /*
+ Horizontal pass.
+ */
{
ssize_t
y;
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
+ const int
+ id = GetOpenMPThreadId();
+
const Quantum
*magick_restrict p;
i;
pixels=scanLinePixels;
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- pixels+=scanLineSize*omp_get_thread_num();
-#endif
+ pixels+=id*scanLineSize;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,
exception);
q=GetCacheViewAuthenticPixels(contrast_view,0,y,image->columns,1,
exception);
-
memcpy(pixels,interImage+(y*(image->columns+(2*width))),(image->columns+
(2*width))*sizeof(float));
-
for (x=0; x < (ssize_t) image->columns; x++)
{
float
sum+=weight*(*pix++);
weight-=1.0f;
}
-
/* Apply and write */
srcVal=(float) GetPixelLuma(image,p);
mult=(srcVal-(sum/totalWeight))*(strength/100.0f);