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:
authorJeroen Bakker <j.bakker@atmind.nl>2012-07-12 00:51:00 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-07-12 00:51:00 +0400
commit4fb850c72ee15cf0a305079e8fb6d23f180fb419 (patch)
treed15b2ecb8f2ed2bb057e6ff04e2e189b347beae1 /source/blender/compositor/operations/COM_OpenCLKernels.cl
parent83d2314edfe2c123c3151884a66c5a6ba2d849f6 (diff)
Compositor:
re-optimized the Defocus node. * localized MemoryBuffers * removed read(x,y) calls * shuffled some lines in the execute pixel * added a readNoCheck function to the memorybuffer (only use this when you are certain you are reading a pixel inside the memorybuffer.
Diffstat (limited to 'source/blender/compositor/operations/COM_OpenCLKernels.cl')
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index 41838e41fba..cbbb4d0b3f2 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -101,16 +101,16 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
- for (int ny = miny; ny < maxy; ny += step) {
- for (int nx = minx; nx < maxx; nx += step) {
- if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {
- inputCoordinate.s0 = nx - offsetInput.s0;
- inputCoordinate.s1 = ny - offsetInput.s1;
- tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
- if (size > threshold && tempSize > threshold) {
- float dx = nx - realCoordinate.s0;
- float dy = ny - realCoordinate.s1;
- if (dx != 0 || dy != 0) {
+ if (size > threshold) {
+ for (int ny = miny; ny < maxy; ny += step) {
+ inputCoordinate.s1 = ny - offsetInput.s1;
+ float dy = ny - realCoordinate.s1;
+ for (int nx = minx; nx < maxx; nx += step) {
+ 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 * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};
bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
@@ -121,8 +121,8 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
}
}
}
- }
- }
+ }
+ }
}
color = color_accum * (1.0f / multiplier_accum);