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-06-13 16:34:56 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-06-13 16:34:56 +0400
commitbe1b5f82cee09041fdee355697841ee92b31ef70 (patch)
tree7032f52aaffb862c228d92a476dc9a0e00261ef1 /source/blender/compositor/operations/COM_GlareGhostOperation.cpp
parent4ba456d1754c29b488b8304c8546af45078e8536 (diff)
* optimized threading
* break out with glare node * Added OpenCL kernels compatible with AMD still need some testing.
Diffstat (limited to 'source/blender/compositor/operations/COM_GlareGhostOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index c5b1d6caa89..383a13c54de 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -45,15 +45,21 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
MemoryBuffer *gbuf = inputTile->duplicate();
MemoryBuffer *tbuf1 = inputTile->duplicate();
+ bool breaked = false;
+
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 0, 3);
- FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 1, 3);
- FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 2, 3);
+ if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 1, 3);
+ if (isBreaked()) breaked = true;
+ if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 2, 3);
MemoryBuffer *tbuf2 = tbuf1->duplicate();
- FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 0, 3);
- FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 1, 3);
- FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 2, 3);
+ if (isBreaked()) breaked = true;
+ if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 0, 3);
+ if (isBreaked()) breaked = true;
+ if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 1, 3);
+ if (isBreaked()) breaked = true;
+ if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 2, 3);
if (settings->iter & 1) ofs = 0.5f; else ofs = 0.f;
for (x=0; x<(settings->iter*4); x++) {
@@ -68,7 +74,7 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
sc = 2.13;
isc = -0.97;
- for (y=0; y<gbuf->getHeight(); y++) {
+ for (y=0; y<gbuf->getHeight() &(!breaked); y++) {
v = (float)(y+0.5f) / (float)gbuf->getHeight();
for (x=0; x<gbuf->getWidth(); x++) {
u = (float)(x+0.5f) / (float)gbuf->getWidth();
@@ -83,11 +89,13 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
gbuf->writePixel(x, y, c);
}
+ if (isBreaked()) breaked = true;
+
}
memset(tbuf1->getBuffer(), 0, tbuf1->getWidth()*tbuf1->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float));
- for (n=1; n<settings->iter; n++) {
- for (y=0; y<gbuf->getHeight(); y++) {
+ for (n=1; n<settings->iter &(!breaked); n++) {
+ for (y=0; y<gbuf->getHeight()&(!breaked); y++) {
v = (float)(y+0.5f) / (float)gbuf->getHeight();
for (x=0; x<gbuf->getWidth(); x++) {
u = (float)(x+0.5f) / (float)gbuf->getWidth();
@@ -103,6 +111,7 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
}
tbuf1->writePixel(x, y, tc);
}
+ if (isBreaked()) breaked = true;
}
memcpy(gbuf->getBuffer(), tbuf1->getBuffer(), tbuf1->getWidth()*tbuf1->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float));
}