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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-10 22:15:28 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-10 22:15:28 +0400
commitb57403eebcf741fe72017ddebe268e1ed2e9d856 (patch)
tree471a392c0ce3d233bd1f7bac59e878b9012daeb0 /source/blender/compositor/operations/COM_KeyingClipOperation.cpp
parentecbd2842dce7e8cd058f9c7088de902cc791041d (diff)
Make keying clamping operation complex so it might directly access input buffer
Seems to give quite noticeable speedup, but there's sometimes strange artifacts showing as darker lines placed in along some kind of tiles. Not sure what causes them yet.
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingClipOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
index 1c92e76c51a..38d67a76c72 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
@@ -36,29 +36,30 @@ KeyingClipOperation::KeyingClipOperation(): NodeOperation()
this->clipBlack = 0.0f;
this->clipWhite = 1.0f;
- this->pixelReader = NULL;
+ this->setComplex(true);
}
-void KeyingClipOperation::initExecution()
+void *KeyingClipOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
{
- this->pixelReader = this->getInputSocketReader(0);
-}
+ void *buffer = getInputOperation(0)->initializeTileData(rect, memoryBuffers);
-void KeyingClipOperation::deinitExecution()
-{
- this->pixelReader = NULL;
+ return buffer;
}
-void KeyingClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void KeyingClipOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
const int delta = 3;
- float pixelColor[4];
- int width = this->getWidth(), height = this->getHeight();
+ MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+ float *buffer = inputBuffer->getBuffer();
+
+ int bufferWidth = inputBuffer->getWidth();
+ int bufferHeight = inputBuffer->getHeight();
+
int count_black = 0, count_white = 0;
int i, j;
- this->pixelReader->read(pixelColor, x, y, sampler, inputBuffers);
+ int srcIndex = (y * bufferWidth + x) * 4;
for (i = -delta + 1; i < delta; i++) {
for (j = -delta + 1; j < delta; j++) {
@@ -67,20 +68,18 @@ void KeyingClipOperation::executePixel(float *color, float x, float y, PixelSamp
if (i == 0 && j == 0)
continue;
- if (cx >= 0 && cx < width && cy >= 0 && cy < height) {
- float value[4];
-
- this->pixelReader->read(value, cx, cy, sampler, inputBuffers);
+ if (cx >= 0 && cx < bufferWidth && cy >= 0 && cy < bufferHeight) {
+ int bufferIndex = (cy * bufferWidth + cx) * 4;
- if (value[0] < 0.4f)
+ if (buffer[bufferIndex] < 0.4f)
count_black++;
- else if (value[0] > 0.6f)
+ else if (buffer[bufferIndex] > 0.6f)
count_white++;
}
}
}
- color[0] = pixelColor[0];
+ color[0] = buffer[srcIndex];
if (count_black >= 22 || count_white >= 22) {
if (color[0] < this->clipBlack)