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:
authorDalai Felinto <dfelinto@gmail.com>2012-08-19 07:05:38 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-08-19 07:05:38 +0400
commit48eb27791bcd0b28b3fad384552009fa4b712d00 (patch)
treecf5cd3bd86ec2c28a20c357ebb3176ad273a6675 /source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
parente4a6602a9ac9c7d43a882770f19323b6d5616a4b (diff)
The Distance Node in 2.49/2.5/2.6 pre-tiles has a different calculation for RGB and YCC. While RGB
calculate the distance in 3d between R,G and B, the YCC only takes Cb and Cr into consideration. This commit makes COM_DistanceMatteOperation inheritable and expose the calculate distance function to be re-implemented for the YCC node operation. Thanks Troy Sobotka for the report over email. Patch incorporates review suggestions by Jeroen Bakker.
Diffstat (limited to 'source/blender/compositor/nodes/COM_DistanceMatteNode.cpp')
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
index d6730ef6a00..87e7b9d0788 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -21,8 +21,10 @@
#include "COM_DistanceMatteNode.h"
#include "BKE_node.h"
-#include "COM_DistanceMatteOperation.h"
+#include "COM_DistanceRGBMatteOperation.h"
+#include "COM_DistanceYCCMatteOperation.h"
#include "COM_SetAlphaOperation.h"
+#include "COM_ConvertRGBToYCCOperation.h"
DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode)
{
@@ -36,12 +38,33 @@ void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCo
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
- DistanceMatteOperation *operation = new DistanceMatteOperation();
+ NodeOperation *operation;
bNode *editorsnode = getbNode();
- operation->setSettings((NodeChroma *)editorsnode->storage);
+ NodeChroma *storage = (NodeChroma *)editorsnode->storage;
- inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
+ /* work in RGB color space */
+ if (storage->channel == 1) {
+ operation = new DistanceRGBMatteOperation();
+ ((DistanceRGBMatteOperation *) operation)->setSettings(storage);
+
+ inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
+ inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
+ }
+ /* work in YCbCr color space */
+ else {
+ operation = new DistanceYCCMatteOperation();
+ ((DistanceYCCMatteOperation *) operation)->setSettings(storage);
+
+ ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation();
+ inputSocketImage->relinkConnections(operationYCCImage->getInputSocket(0), 0, graph);
+ addLink(graph, operationYCCImage->getOutputSocket(), operation->getInputSocket(0));
+ graph->addOperation(operationYCCImage);
+
+ ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation();
+ inputSocketKey->relinkConnections(operationYCCMatte->getInputSocket(0), 1, graph);
+ addLink(graph, operationYCCMatte->getOutputSocket(), operation->getInputSocket(1));
+ graph->addOperation(operationYCCMatte);
+ }
if (outputSocketMatte->isConnected()) {
outputSocketMatte->relinkConnections(operation->getOutputSocket());