Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-08 22:04:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-08 22:04:40 +0400
commita401971cf88e3acadb04243929822da6fcf03174 (patch)
treed88097772419fb4976839a2037bd3167ba0c38f3 /source/blender/compositor/operations/COM_OpenCLKernels.cl
parent543cee14ca9a6b89a1b26ccbfda1d58743db71af (diff)
sync changes between opencl and C++ VariableSizeBokehBlurOperation, also remove absf() check on pixel radius, this is ensured to be unsigned.
Diffstat (limited to 'source/blender/compositor/operations/COM_OpenCLKernels.cl')
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl24
1 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index 4f43650370d..441f6af79a5 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -86,8 +86,9 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
const int2 realCoordinate = coords + offsetOutput;
float4 readColor;
+ float4 tempColor;
float4 bokeh;
- float tempSize;
+ float size;
float4 multiplier_accum = {1.0f, 1.0f, 1.0f, 1.0f};
float4 color_accum;
@@ -98,10 +99,10 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
{
int2 inputCoordinate = realCoordinate - offsetInput;
- float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
+ float size_center = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
- if (size > threshold) {
+ if (size_center > threshold) {
for (int ny = miny; ny < maxy; ny += step) {
inputCoordinate.s1 = ny - offsetInput.s1;
float dy = ny - realCoordinate.s1;
@@ -109,13 +110,14 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float dx = nx - realCoordinate.s0;
if (dx != 0 || dy != 0) {
inputCoordinate.s0 = nx - offsetInput.s0;
- tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
- if (tempSize > threshold) {
- if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {
- float2 uv = { 256.0f + dx * 255.0f / tempSize, 256.0f + dy * 255.0f / tempSize};
+ size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
+ if (size > threshold) {
+ if (size >= fabs(dx) && size >= fabs(dy)) {
+ float2 uv = {256.0f + dx * 255.0f / size,
+ 256.0f + dy * 255.0f / size};
bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
- readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
- color_accum += bokeh*readColor;
+ tempColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
+ color_accum += bokeh * tempColor;
multiplier_accum += bokeh;
}
}
@@ -150,7 +152,7 @@ __kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image
const float deltaY = (realCoordinate.y - ny);
for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {
const float deltaX = (realCoordinate.x - nx);
- const float measuredDistance = deltaX*deltaX+deltaY*deltaY;
+ const float measuredDistance = deltaX * deltaX + deltaY * deltaY;
if (measuredDistance <= distanceSquared) {
value = max(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);
}
@@ -181,7 +183,7 @@ __kernel void erodeKernel(__read_only image2d_t inputImage, __write_only image2
for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {
const float deltaX = (realCoordinate.x - nx);
const float deltaY = (realCoordinate.y - ny);
- const float measuredDistance = deltaX*deltaX+deltaY*deltaY;
+ const float measuredDistance = deltaX * deltaX+deltaY * deltaY;
if (measuredDistance <= distanceSquared) {
value = min(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);
}