From: dirk Date: Sat, 23 Apr 2016 18:40:54 +0000 (+0200) Subject: Fixed bug in OpenCL kernel and fixed name of method. X-Git-Tag: 7.0.1-0~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a8f72432afccff78ffef4db21b55139b7cb7803;p=imagemagick Fixed bug in OpenCL kernel and fixed name of method. --- diff --git a/MagickCore/accelerate-private.h b/MagickCore/accelerate-private.h index 0b7db5d2e..a9a0563e8 100644 --- a/MagickCore/accelerate-private.h +++ b/MagickCore/accelerate-private.h @@ -2719,10 +2719,13 @@ OPENCL_ENDIF() if (itemID < actualNumPixelInThisChunk) { - float density = densityCache[itemID]; - float gamma = gammaCache[itemID]; float4 filteredPixel = outputPixelCache[itemID]; + float gamma = 0.0f; + if ((number_channels == 4) || (number_channels == 2)) + gamma = gammaCache[itemID]; + + float density = densityCache[itemID]; if ((density != 0.0f) && (density != 1.0f)) { density = PerceptibleReciprocal(density); @@ -2880,10 +2883,13 @@ OPENCL_ENDIF() if (itemID < actualNumPixelInThisChunk) { - float density = densityCache[itemID]; - float gamma = gammaCache[itemID]; float4 filteredPixel = outputPixelCache[itemID]; + float gamma = 0.0f; + if ((number_channels == 4) || (number_channels == 2)) + gamma = gammaCache[itemID]; + + float density = densityCache[itemID]; if ((density != 0.0f) && (density != 1.0f)) { density = PerceptibleReciprocal(density); diff --git a/MagickCore/accelerate.c b/MagickCore/accelerate.c index de9be6c2a..17e9faf0b 100644 --- a/MagickCore/accelerate.c +++ b/MagickCore/accelerate.c @@ -4534,7 +4534,7 @@ static MagickBooleanType resizeHorizontalFilter(MagickCLEnv clEnv, resizeWindowType; MagickBooleanType - status = MagickFalse; + status; size_t gammaAccumulatorLocalMemorySize, @@ -4680,7 +4680,6 @@ RestoreMSCWarning local_work_size[0] = workgroupSize; local_work_size[1] = 1; clStatus = clEnv->library->clEnqueueNDRangeKernel(queue, horizontalKernel, 2, NULL, global_work_size, local_work_size, 0, NULL, &event); - (void) local_work_size; if (clStatus != CL_SUCCESS) { (void) OpenCLThrowMagickException(device,exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clEnqueueNDRangeKernel failed.", "'%s'", "."); @@ -4731,7 +4730,7 @@ static MagickBooleanType resizeVerticalFilter(MagickCLEnv clEnv, resizeWindowType; MagickBooleanType - status = MagickFalse; + status; size_t gammaAccumulatorLocalMemorySize, diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index f7e8ba930..48281461b 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -1202,7 +1202,7 @@ static MagickBooleanType LoadCachedOpenCLKernel(MagickCLDevice device, MagickTrue); } -static void LogOpenCLBuildFature(MagickCLDevice device,const char *kernel, +static void LogOpenCLBuildFailure(MagickCLDevice device,const char *kernel, ExceptionInfo *exception) { char @@ -1215,6 +1215,7 @@ static void LogOpenCLBuildFature(MagickCLDevice device,const char *kernel, (void) FormatLocaleString(filename,MagickPathExtent,"%s%s%s", GetOpenCLCacheDirectory(),DirectorySeparator,"magick_badcl.cl"); + (void) remove_utf8(filename); (void) BlobToFile(filename,kernel,strlen(kernel),exception); openCL_library->clGetProgramBuildInfo(device->program,device->deviceID, @@ -1226,6 +1227,7 @@ static void LogOpenCLBuildFature(MagickCLDevice device,const char *kernel, (void) FormatLocaleString(filename,MagickPathExtent,"%s%s%s", GetOpenCLCacheDirectory(),DirectorySeparator,"magick_badcl.log"); + (void) remove_utf8(filename); (void) BlobToFile(filename,log,logSize,exception); } @@ -1292,7 +1294,7 @@ static MagickBooleanType CompileOpenCLKernel(MagickCLDevice device, { (void) ThrowMagickException(exception,GetMagickModule(),DelegateWarning, "clBuildProgram failed.","(%d)",(int)status); - LogOpenCLBuildFature(device,kernel,exception); + LogOpenCLBuildFailure(device,kernel,exception); return(MagickFalse); }