Generate a 1-D convolution kernel.
*/
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
- kernel=(double *) AcquireQuantumMemory((size_t) width,sizeof(*kernel));
+ kernel=(double *) AcquireAlignedMemory((size_t) width,sizeof(*kernel));
if (kernel == (double *) NULL)
return(0);
normalize=0.0;
continue;
p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y,
image->columns+width,1,exception);
- q=GetCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
+ q=QueueCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{
}
blur_view=DestroyCacheView(blur_view);
image_view=DestroyCacheView(image_view);
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
+ blur_image->type=image->type;
if (status == MagickFalse)
blur_image=DestroyImage(blur_image);
- blur_image->type=image->type;
return(blur_image);
}
\f
Generate a 1-D convolution kernel.
*/
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
- kernel=(double *) AcquireQuantumMemory((size_t) width,sizeof(*kernel));
+ kernel=(double *) AcquireAlignedMemory((size_t) width,sizeof(*kernel));
if (kernel == (double *) NULL)
return(kernel);
normalize=0.0;
{
CacheView
*blur_view,
- *image_view;
+ *image_view,
+ *motion_view;
double
*kernel;
offset=(OffsetInfo *) AcquireQuantumMemory(width,sizeof(*offset));
if (offset == (OffsetInfo *) NULL)
{
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
}
blur_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
if (blur_image == (Image *) NULL)
{
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
offset=(OffsetInfo *) RelinquishMagickMemory(offset);
return((Image *) NULL);
}
if (SetImageStorageClass(blur_image,DirectClass,exception) == MagickFalse)
{
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
offset=(OffsetInfo *) RelinquishMagickMemory(offset);
blur_image=DestroyImage(blur_image);
return((Image *) NULL);
status=MagickTrue;
progress=0;
image_view=AcquireCacheView(image);
+ motion_view=AcquireCacheView(image);
blur_view=AcquireCacheView(blur_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
if (status == MagickFalse)
continue;
- p=GetCacheViewVirtualPixels(blur_view,0,y,image->columns,1,exception);
- q=GetCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
+ p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
+ q=QueueCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{
{
for (j=0; j < (ssize_t) width; j++)
{
- r=GetCacheViewVirtualPixels(image_view,x+offset[j].x,y+
+ r=GetCacheViewVirtualPixels(motion_view,x+offset[j].x,y+
offset[j].y,1,1,exception);
if (r == (const Quantum *) NULL)
{
gamma=0.0;
for (j=0; j < (ssize_t) width; j++)
{
- r=GetCacheViewVirtualPixels(image_view,x+offset[j].x,y+offset[j].y,1,
+ r=GetCacheViewVirtualPixels(motion_view,x+offset[j].x,y+offset[j].y,1,
1,exception);
if (r == (const Quantum *) NULL)
{
}
}
blur_view=DestroyCacheView(blur_view);
+ motion_view=DestroyCacheView(motion_view);
image_view=DestroyCacheView(image_view);
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
offset=(OffsetInfo *) RelinquishMagickMemory(offset);
if (status == MagickFalse)
blur_image=DestroyImage(blur_image);
{
CacheView
*blur_view,
- *image_view;
+ *image_view,
+ *radial_view;
Image
*blur_image;
status=MagickTrue;
progress=0;
image_view=AcquireCacheView(image);
+ radial_view=AcquireCacheView(image);
blur_view=AcquireCacheView(blur_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
if (status == MagickFalse)
continue;
- p=GetCacheViewVirtualPixels(blur_view,0,y,image->columns,1,exception);
- q=GetCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
+ p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
+ q=QueueCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{
{
for (j=0; j < (ssize_t) n; j+=(ssize_t) step)
{
- r=GetCacheViewVirtualPixels(image_view, (ssize_t) (blur_center.x+
+ r=GetCacheViewVirtualPixels(radial_view, (ssize_t) (blur_center.x+
center.x*cos_theta[j]-center.y*sin_theta[j]+0.5),(ssize_t)
(blur_center.y+center.x*sin_theta[j]+center.y*cos_theta[j]+0.5),
1,1,exception);
}
for (j=0; j < (ssize_t) n; j+=(ssize_t) step)
{
- r=GetCacheViewVirtualPixels(image_view, (ssize_t) (blur_center.x+
+ r=GetCacheViewVirtualPixels(radial_view, (ssize_t) (blur_center.x+
center.x*cos_theta[j]-center.y*sin_theta[j]+0.5),(ssize_t)
(blur_center.y+center.x*sin_theta[j]+center.y*cos_theta[j]+0.5),
1,1,exception);
}
}
blur_view=DestroyCacheView(blur_view);
+ radial_view=DestroyCacheView(radial_view);
image_view=DestroyCacheView(image_view);
cos_theta=(MagickRealType *) RelinquishMagickMemory(cos_theta);
sin_theta=(MagickRealType *) RelinquishMagickMemory(sin_theta);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
width=GetOptimalKernelWidth1D(radius,sigma);
- kernel=(double *) AcquireQuantumMemory((size_t) width,width*sizeof(*kernel));
+ kernel=(double *) AcquireAlignedMemory((size_t) width,width*sizeof(*kernel));
if (kernel == (double *) NULL)
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
j=(ssize_t) width/2;
continue;
p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)
(width/2L),image->columns+width,width,exception);
- q=GetCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
+ q=QueueCacheViewAuthenticPixels(blur_view,0,y,blur_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{
blur_image->type=image->type;
blur_view=DestroyCacheView(blur_view);
image_view=DestroyCacheView(image_view);
- kernel=(double *) RelinquishMagickMemory(kernel);
+ kernel=(double *) RelinquishAlignedMemory(kernel);
if (status == MagickFalse)
blur_image=DestroyImage(blur_image);
return(blur_image);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
-
-
- /* FUTURE: use of bias on sharpen is non-sensical */
unsharp_image=BlurImage(image,radius,sigma,image->bias,exception);
-
if (unsharp_image == (Image *) NULL)
return((Image *) NULL);
quantum_threshold=(MagickRealType) QuantumRange*threshold;
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
- q=GetCacheViewAuthenticPixels(unsharp_view,0,y,unsharp_image->columns,1,
+ q=QueueCacheViewAuthenticPixels(unsharp_view,0,y,unsharp_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{