}
outputReady=EnqueueOpenCLKernel(queue,addNoiseKernel,1,(const size_t *) NULL,gsize,
- lsize,image,filteredImage,exception);
+ lsize,image,filteredImage,MagickFalse,exception);
cleanup:
lsize[1]=1;
outputReady=EnqueueOpenCLKernel(queue,blurRowKernel,2,(size_t *) NULL,gsize,
- lsize,image,filteredImage,exception);
+ lsize,image,filteredImage,MagickFalse,exception);
if (outputReady == MagickFalse)
goto cleanup;
lsize[1]=chunkSize;
outputReady=EnqueueOpenCLKernel(queue,blurColumnKernel,2,(size_t *) NULL,gsize,
- lsize,image,filteredImage,exception);
+ lsize,image,filteredImage,MagickFalse,exception);
cleanup:
gsize[1]=image->rows;
outputReady=EnqueueOpenCLKernel(queue,contrastKernel,2,(const size_t *) NULL,
- gsize,(const size_t *) NULL,image,(Image *) NULL,exception);
+ gsize,(const size_t *) NULL,image,(Image *) NULL,MagickFalse,exception);
cleanup:
device = RequestOpenCLDevice(clEnv);
+ /* Work around an issue on NVIDIA devices */
+ if (strcmp("NVIDIA Corporation",device->vendor_name) == 0)
+ goto cleanup;
+
image_view=AcquireAuthenticCacheView(image,exception);
inputPixels=GetCacheViewAuthenticPixels(image_view,0,0,image->columns,image->rows,exception);
if (inputPixels == (const void *) NULL)
gsize[0]=image->columns;
gsize[1]=image->rows;
outputReady=EnqueueOpenCLKernel(queue,functionKernel,2,(const size_t *) NULL,
- gsize,(const size_t *) NULL,image,(const Image *) NULL,exception);
+ gsize,(const size_t *) NULL,image,(const Image *) NULL,MagickFalse,
+ exception);
cleanup:
gsize[1]=image->rows;
outputReady=EnqueueOpenCLKernel(queue,grayscaleKernel,2,
(const size_t *) NULL,gsize,(const size_t *) NULL,image,(Image *) NULL,
- exception);
+ MagickFalse,exception);
cleanup:
size_t goffset[2];
gsize[0] = 256;
- gsize[1] = image->rows / passes;
+ gsize[1] = (image->rows + passes - 1) / passes;
wsize[0] = 256;
wsize[1] = 1;
goffset[0] = 0;
lsize[0]=workgroupSize;
lsize[1]=1;
outputReady=EnqueueOpenCLKernel(queue,horizontalKernel,2,
- (const size_t *) NULL,gsize,lsize,image,filteredImage,exception);
+ (const size_t *) NULL,gsize,lsize,image,filteredImage,MagickFalse,
+ exception);
+
cleanup:
if (horizontalKernel != (cl_kernel) NULL)
lsize[0]=1;
lsize[1]=workgroupSize;
outputReady=EnqueueOpenCLKernel(queue,verticalKernel,2,(const size_t *) NULL,
- gsize,lsize,image,filteredImage,exception);
+ gsize,lsize,image,filteredImage,MagickFalse,exception);
cleanup:
gsize[1]=image->rows;
outputReady=EnqueueOpenCLKernel(queue,rotationalBlurKernel,2,
(const size_t *) NULL,gsize,(const size_t *) NULL,image,filteredImage,
- exception);
+ MagickFalse,exception);
cleanup:
lsize[0]=chunkSize;
lsize[1]=1;
outputReady=EnqueueOpenCLKernel(queue,blurRowKernel,2,
- (const size_t *) NULL,gsize,lsize,image,filteredImage,exception);
-
+ (const size_t *) NULL,gsize,lsize,image,filteredImage,MagickFalse,
+ exception);
+
chunkSize=256;
fGain=(float) gain;
fThreshold=(float) threshold;
lsize[0]=1;
lsize[1]=chunkSize;
outputReady=EnqueueOpenCLKernel(queue,unsharpMaskBlurColumnKernel,2,
- (const size_t *) NULL,gsize,lsize,image,filteredImage,exception);
+ (const size_t *) NULL,gsize,lsize,image,filteredImage,MagickFalse,
+ exception);
cleanup:
lsize[0]=8;
lsize[1]=32;
outputReady=EnqueueOpenCLKernel(queue,unsharpMaskKernel,2,(const size_t *) NULL,
- gsize,lsize,image,filteredImage,exception);
+ gsize,lsize,image,filteredImage,MagickFalse,exception);
cleanup:
device;
size_t
+ goffset[2],
gsize[2],
i,
- lsize[2];
+ lsize[2],
+ passes,
+ x;
filteredImage=NULL;
denoiseKernel=NULL;
+ queue=NULL;
outputReady=MagickFalse;
device=RequestOpenCLDevice(clEnv);
+ /* Work around an issue on low end Intel devices */
+ if (strcmp("Intel(R) HD Graphics",device->name) == 0)
+ goto cleanup;
queue=AcquireOpenCLCommandQueue(device);
filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
exception);
if ((max_channels == 4) || (max_channels == 2))
max_channels=max_channels-1;
thresh=threshold;
+ passes=(((1.0f*image->columns)*image->rows)+1999999.0f)/2000000.0f;
+ passes=(passes < 1) ? 1 : passes;
i=0;
status =SetOpenCLKernelArg(denoiseKernel,i++,sizeof(cl_mem),(void *)&imageBuffer);
status|=SetOpenCLKernelArg(denoiseKernel,i++,sizeof(cl_uint),(void *)&width);
status|=SetOpenCLKernelArg(denoiseKernel,i++,sizeof(cl_uint),(void *)&height);
if (status != CL_SUCCESS)
+ {
+ (void) OpenCLThrowMagickException(device,exception,GetMagickModule(),
+ ResourceLimitWarning,"SetOpenCLKernelArg failed.",".");
+ goto cleanup;
+ }
+
+ for (x = 0; x < passes; ++x)
{
- (void) OpenCLThrowMagickException(device,exception,GetMagickModule(),
- ResourceLimitWarning,"SetOpenCLKernelArg failed.",".");
- goto cleanup;
- }
+ gsize[0]=((width+(SIZE-1))/SIZE)*TILESIZE;
+ gsize[1]=((((height+(SIZE-1))/SIZE)+passes-1)/passes)*4;
+ lsize[0]=TILESIZE;
+ lsize[1]=4;
+ goffset[0]=0;
+ goffset[1]=x*gsize[1];
- gsize[0]=((width+(SIZE-1))/SIZE)*TILESIZE;
- gsize[1]=((height+(SIZE-1))/SIZE)*4;
- lsize[0]=TILESIZE;
- lsize[1]=4;
- outputReady=EnqueueOpenCLKernel(queue,denoiseKernel,2,(const size_t *) NULL,
- gsize,lsize,image,filteredImage,exception);
+ outputReady=EnqueueOpenCLKernel(queue,denoiseKernel,2,goffset,gsize,lsize,
+ image,filteredImage,MagickTrue,exception);
+ if (outputReady == MagickFalse)
+ break;
+ }
cleanup: