diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-09-05 17:32:14 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-09-05 17:32:14 +0400 |
commit | 028371c174189278dd30e3c7f5a2b4a50910fd77 (patch) | |
tree | 4e6c263d404f8520570fb2c884192bd928db2f01 | |
parent | bed447b244ac949807baa27b61d00d45b547e5c9 (diff) |
Compositor cleanup: Merge conversion operations into a single file (see also r59820).
Most convert operations can share a common base class with a single socket reader (except channel separate/combine nodes).
58 files changed, 657 insertions, 1941 deletions
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index e14950869e0..29049511321 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -394,37 +394,11 @@ set(SRC operations/COM_PreviewOperation.cpp operations/COM_SplitOperation.h operations/COM_SplitOperation.cpp - operations/COM_ConvertValueToColorProg.h - operations/COM_ConvertValueToColorProg.cpp - operations/COM_ConvertColorToValueProg.h - operations/COM_ConvertColorToValueProg.cpp - operations/COM_ConvertColorToBWOperation.h - operations/COM_ConvertColorToBWOperation.cpp - operations/COM_ConvertColorToVectorOperation.h - operations/COM_ConvertColorToVectorOperation.cpp - operations/COM_ConvertValueToVectorOperation.h - operations/COM_ConvertValueToVectorOperation.cpp - operations/COM_ConvertVectorToColorOperation.h - operations/COM_ConvertVectorToColorOperation.cpp - operations/COM_ConvertVectorToValueOperation.h - operations/COM_ConvertVectorToValueOperation.cpp operations/COM_ConvertDepthToRadiusOperation.h operations/COM_ConvertDepthToRadiusOperation.cpp operations/COM_ZCombineOperation.cpp operations/COM_ZCombineOperation.h - operations/COM_ConvertRGBToYCCOperation.h - operations/COM_ConvertRGBToYCCOperation.cpp - operations/COM_ConvertYCCToRGBOperation.h - operations/COM_ConvertYCCToRGBOperation.cpp - operations/COM_ConvertRGBToYUVOperation.h - operations/COM_ConvertRGBToYUVOperation.cpp - operations/COM_ConvertYUVToRGBOperation.h - operations/COM_ConvertYUVToRGBOperation.cpp - operations/COM_ConvertRGBToHSVOperation.h - operations/COM_ConvertRGBToHSVOperation.cpp - operations/COM_ConvertHSVToRGBOperation.h - operations/COM_ConvertHSVToRGBOperation.cpp operations/COM_ChangeHSVOperation.h operations/COM_ChangeHSVOperation.cpp operations/COM_ColorCurveOperation.h @@ -451,10 +425,6 @@ set(SRC operations/COM_ColorMatteOperation.h operations/COM_ChannelMatteOperation.cpp operations/COM_ChannelMatteOperation.h - operations/COM_ConvertPremulToStraightOperation.cpp - operations/COM_ConvertPremulToStraightOperation.h - operations/COM_ConvertStraightToPremulOperation.cpp - operations/COM_ConvertStraightToPremulOperation.h operations/COM_ReadBufferOperation.cpp operations/COM_ReadBufferOperation.h @@ -556,11 +526,8 @@ set(SRC #Convert operations operations/COM_IDMaskOperation.cpp operations/COM_IDMaskOperation.h - - operations/COM_SeparateChannelOperation.cpp - operations/COM_SeparateChannelOperation.h - operations/COM_CombineChannelsOperation.cpp - operations/COM_CombineChannelsOperation.h + operations/COM_ConvertOperation.cpp + operations/COM_ConvertOperation.h operations/COM_DotproductOperation.cpp operations/COM_DotproductOperation.h diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index db0cdd1692e..384cfbe47fa 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -47,12 +47,7 @@ #include "COM_CombineYUVANode.h" #include "COM_CompositorNode.h" #include "COM_ConvertAlphaNode.h" -#include "COM_ConvertColorToVectorOperation.h" -#include "COM_ConvertColorToValueProg.h" -#include "COM_ConvertValueToColorProg.h" -#include "COM_ConvertValueToVectorOperation.h" -#include "COM_ConvertVectorToColorOperation.h" -#include "COM_ConvertVectorToValueOperation.h" +#include "COM_ConvertOperation.h" #include "COM_Converter.h" #include "COM_CropNode.h" #include "COM_DefocusNode.h" @@ -420,13 +415,13 @@ void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *s DataType toDatatype = inputSocket->getDataType(); NodeOperation *converter = NULL; if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) { - converter = new ConvertValueToColorProg(); + converter = new ConvertValueToColorOperation(); } else if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_VECTOR) { converter = new ConvertValueToVectorOperation(); } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VALUE) { - converter = new ConvertColorToValueProg(); + converter = new ConvertColorToValueOperation(); } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VECTOR) { converter = new ConvertColorToVectorOperation(); diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp index c1511ee611b..4c136583936 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp @@ -22,9 +22,7 @@ #include "COM_ChannelMatteNode.h" #include "BKE_node.h" #include "COM_ChannelMatteOperation.h" -#include "COM_ConvertRGBToHSVOperation.h" -#include "COM_ConvertRGBToYCCOperation.h" -#include "COM_ConvertRGBToYUVOperation.h" +#include "COM_ConvertOperation.h" #include "COM_SetAlphaOperation.h" ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp index d2598e661a9..c23f242ca5c 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp @@ -22,7 +22,7 @@ #include "COM_ChromaMatteNode.h" #include "BKE_node.h" #include "COM_ChromaMatteOperation.h" -#include "COM_ConvertRGBToYCCOperation.h" +#include "COM_ConvertOperation.h" #include "COM_SetAlphaOperation.h" ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp index 54e6762961b..8ab93a58a1d 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp @@ -22,7 +22,7 @@ #include "COM_ColorMatteNode.h" #include "BKE_node.h" #include "COM_ColorMatteOperation.h" -#include "COM_ConvertRGBToHSVOperation.h" +#include "COM_ConvertOperation.h" #include "COM_SetAlphaOperation.h" ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cpp b/source/blender/compositor/nodes/COM_ColorRampNode.cpp index a79c7885ae4..6f715a8f278 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp @@ -24,7 +24,7 @@ #include "COM_ExecutionSystem.h" #include "BKE_node.h" #include "COM_ColorRampOperation.h" -#include "COM_SeparateChannelOperation.h" +#include "COM_ConvertOperation.h" #include "DNA_texture_types.h" ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp index 511fdf09f41..07be93dab86 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp @@ -22,7 +22,7 @@ #include "COM_ColorToBWNode.h" -#include "COM_ConvertColorToBWOperation.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp b/source/blender/compositor/nodes/COM_CombineHSVANode.cpp index beba41fade9..9f6614ed8c3 100644 --- a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp +++ b/source/blender/compositor/nodes/COM_CombineHSVANode.cpp @@ -22,11 +22,11 @@ #include "COM_CombineHSVANode.h" -#include "COM_CombineChannelsOperation.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" -#include "COM_ConvertHSVToRGBOperation.h" +#include "COM_ConvertOperation.h" CombineHSVANode::CombineHSVANode(bNode *editorNode) : CombineRGBANode(editorNode) { diff --git a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp index a8cdd8c2950..8dfded049e5 100644 --- a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp +++ b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp @@ -22,7 +22,7 @@ #include "COM_CombineRGBANode.h" -#include "COM_CombineChannelsOperation.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" diff --git a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp b/source/blender/compositor/nodes/COM_CombineYCCANode.cpp index 5319eb84184..ee787a4f9c1 100644 --- a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp +++ b/source/blender/compositor/nodes/COM_CombineYCCANode.cpp @@ -20,7 +20,7 @@ */ #include "COM_CombineYCCANode.h" -#include "COM_ConvertYCCToRGBOperation.h" +#include "COM_ConvertOperation.h" CombineYCCANode::CombineYCCANode(bNode *editorNode) : CombineRGBANode(editorNode) { diff --git a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp b/source/blender/compositor/nodes/COM_CombineYUVANode.cpp index 48c2c6ca649..feee443cf05 100644 --- a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp +++ b/source/blender/compositor/nodes/COM_CombineYUVANode.cpp @@ -20,7 +20,7 @@ */ #include "COM_CombineYUVANode.h" -#include "COM_ConvertYUVToRGBOperation.h" +#include "COM_ConvertOperation.h" CombineYUVANode::CombineYUVANode(bNode *editorNode) : CombineRGBANode(editorNode) { diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp index a7149cc63b2..72f3ed07fd5 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp @@ -20,8 +20,7 @@ */ #include "COM_ConvertAlphaNode.h" -#include "COM_ConvertPremulToStraightOperation.h" -#include "COM_ConvertStraightToPremulOperation.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp index 782c897f6fb..3c532fe0b1d 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp @@ -24,7 +24,7 @@ #include "COM_DistanceRGBMatteOperation.h" #include "COM_DistanceYCCMatteOperation.h" #include "COM_SetAlphaOperation.h" -#include "COM_ConvertRGBToYCCOperation.h" +#include "COM_ConvertOperation.h" DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode) { diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp index f9ca76d745f..66b98b29d5e 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp @@ -22,10 +22,8 @@ #include "COM_HueSaturationValueCorrectNode.h" -#include "COM_ConvertColorToValueProg.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" -#include "COM_ConvertRGBToHSVOperation.h" -#include "COM_ConvertHSVToRGBOperation.h" #include "COM_MixOperation.h" #include "COM_SetColorOperation.h" #include "COM_SetValueOperation.h" diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp index 4ae2e3d6b9d..5001433513c 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp @@ -22,10 +22,8 @@ #include "COM_HueSaturationValueNode.h" -#include "COM_ConvertColorToValueProg.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" -#include "COM_ConvertRGBToHSVOperation.h" -#include "COM_ConvertHSVToRGBOperation.h" #include "COM_MixOperation.h" #include "COM_SetColorOperation.h" #include "COM_SetValueOperation.h" diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index b8d9841c92a..c3aaf8358fe 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -25,7 +25,7 @@ #include "COM_ExecutionSystem.h" #include "COM_ImageOperation.h" #include "COM_MultilayerImageOperation.h" -#include "COM_ConvertPremulToStraightOperation.h" +#include "COM_ConvertOperation.h" #include "BKE_node.h" #include "BLI_utildefines.h" diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index 51ea2913e65..786530bd3c4 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -32,10 +32,7 @@ #include "COM_MathBaseOperation.h" -#include "COM_SeparateChannelOperation.h" -#include "COM_CombineChannelsOperation.h" -#include "COM_ConvertRGBToYCCOperation.h" -#include "COM_ConvertYCCToRGBOperation.h" +#include "COM_ConvertOperation.h" #include "COM_SetValueOperation.h" #include "COM_DilateErodeOperation.h" diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp index 4656e00b006..b1e6967ba42 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp @@ -22,7 +22,7 @@ #include "COM_LuminanceMatteNode.h" #include "BKE_node.h" #include "COM_LuminanceMatteOperation.h" -#include "COM_ConvertRGBToYUVOperation.h" +#include "COM_ConvertOperation.h" #include "COM_SetAlphaOperation.h" LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode) diff --git a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp b/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp index 4f93b226fa1..4cd77d4bae6 100644 --- a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp @@ -22,10 +22,9 @@ #include "COM_SeparateHSVANode.h" -#include "COM_SeparateChannelOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" -#include "COM_ConvertRGBToHSVOperation.h" +#include "COM_ConvertOperation.h" SeparateHSVANode::SeparateHSVANode(bNode *editorNode) : SeparateRGBANode(editorNode) { diff --git a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp index 7fcdebadb46..7d9bff30a93 100644 --- a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp @@ -22,7 +22,7 @@ #include "COM_SeparateRGBANode.h" -#include "COM_SeparateChannelOperation.h" +#include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" #include "DNA_material_types.h" // the ramp types diff --git a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp b/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp index 154e2bcd550..797cd49316a 100644 --- a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp @@ -20,10 +20,9 @@ */ #include "COM_SeparateYCCANode.h" -#include "COM_SeparateChannelOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" -#include "COM_ConvertRGBToYCCOperation.h" +#include "COM_ConvertOperation.h" SeparateYCCANode::SeparateYCCANode(bNode *editorNode) : SeparateRGBANode(editorNode) { diff --git a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp b/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp index 8a647b7f849..9a6ec20fa80 100644 --- a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp @@ -20,10 +20,9 @@ */ #include "COM_SeparateYUVANode.h" -#include "COM_SeparateChannelOperation.h" #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" -#include "COM_ConvertRGBToYUVOperation.h" +#include "COM_ConvertOperation.h" SeparateYUVANode::SeparateYUVANode(bNode *editorNode) : SeparateRGBANode(editorNode) { diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp deleted file mode 100644 index 3ced0548bb8..00000000000 --- a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_CombineChannelsOperation.h" -#include "BLI_utildefines.h" - -CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_VALUE); - this->addInputSocket(COM_DT_VALUE); - this->addInputSocket(COM_DT_VALUE); - this->addInputSocket(COM_DT_VALUE); - this->addOutputSocket(COM_DT_COLOR); - this->setResolutionInputSocketIndex(0); - this->m_inputChannel1Operation = NULL; - this->m_inputChannel2Operation = NULL; - this->m_inputChannel3Operation = NULL; - this->m_inputChannel4Operation = NULL; -} - -void CombineChannelsOperation::initExecution() -{ - this->m_inputChannel1Operation = this->getInputSocketReader(0); - this->m_inputChannel2Operation = this->getInputSocketReader(1); - this->m_inputChannel3Operation = this->getInputSocketReader(2); - this->m_inputChannel4Operation = this->getInputSocketReader(3); -} - -void CombineChannelsOperation::deinitExecution() -{ - this->m_inputChannel1Operation = NULL; - this->m_inputChannel2Operation = NULL; - this->m_inputChannel3Operation = NULL; - this->m_inputChannel4Operation = NULL; -} - - -void CombineChannelsOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float input[4]; - if (this->m_inputChannel1Operation) { - this->m_inputChannel1Operation->read(input, x, y, sampler); - output[0] = input[0]; - } - if (this->m_inputChannel2Operation) { - this->m_inputChannel2Operation->read(input, x, y, sampler); - output[1] = input[0]; - } - if (this->m_inputChannel3Operation) { - this->m_inputChannel3Operation->read(input, x, y, sampler); - output[2] = input[0]; - } - if (this->m_inputChannel4Operation) { - this->m_inputChannel4Operation->read(input, x, y, sampler); - output[3] = input[0]; - } -} diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.h b/source/blender/compositor/operations/COM_CombineChannelsOperation.h deleted file mode 100644 index 7c8742b1557..00000000000 --- a/source/blender/compositor/operations/COM_CombineChannelsOperation.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_CombineChannelsOperation_h_ -#define _COM_CombineChannelsOperation_h_ - -#include "COM_NodeOperation.h" - -class CombineChannelsOperation : public NodeOperation { -private: - SocketReader *m_inputChannel1Operation; - SocketReader *m_inputChannel2Operation; - SocketReader *m_inputChannel3Operation; - SocketReader *m_inputChannel4Operation; -public: - CombineChannelsOperation(); - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - void initExecution(); - void deinitExecution(); -}; - -#endif diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp deleted file mode 100644 index 3b5aa8cd755..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertColorToBWOperation.h" - -ConvertColorToBWOperation::ConvertColorToBWOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; -} - -void ConvertColorToBWOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertColorToBWOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - output[0] = rgb_to_bw(inputColor); -} - -void ConvertColorToBWOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h deleted file mode 100644 index 963bd32a2f6..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertColorToBWOperation_h -#define _COM_ConvertColorToBWOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertColorToBWOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertColorToBWOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp deleted file mode 100644 index 44e751d1cae..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertColorToValueProg.h" - -ConvertColorToValueProg::ConvertColorToValueProg() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; -} - -void ConvertColorToValueProg::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertColorToValueProg::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; -} - -void ConvertColorToValueProg::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.h b/source/blender/compositor/operations/COM_ConvertColorToValueProg.h deleted file mode 100644 index 5c25d5d0540..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertColorToValueProg_h -#define _COM_ConvertColorToValueProg_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertColorToValueProg : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertColorToValueProg(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp deleted file mode 100644 index a9b8cbb4272..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertColorToVectorOperation.h" - -ConvertColorToVectorOperation::ConvertColorToVectorOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_VECTOR); - this->m_inputOperation = NULL; -} - -void ConvertColorToVectorOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertColorToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - this->m_inputOperation->read(output, x, y, sampler); -} - -void ConvertColorToVectorOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h deleted file mode 100644 index 93644cb5d1c..00000000000 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertColorToVectorOperation_h -#define _COM_ConvertColorToVectorOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertColorToVectorOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertColorToVectorOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp deleted file mode 100644 index 65907a8e537..00000000000 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertHSVToRGBOperation.h" -#include "BLI_math_color.h" - -ConvertHSVToRGBOperation::ConvertHSVToRGBOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertHSVToRGBOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertHSVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - hsv_to_rgb_v(inputColor, output); - output[3] = inputColor[3]; -} - -void ConvertHSVToRGBOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} - diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h deleted file mode 100644 index 17419ca2a05..00000000000 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertHSVToRGBOperation_h -#define _COM_ConvertHSVToRGBOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertHSVToRGBOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertHSVToRGBOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cpp b/source/blender/compositor/operations/COM_ConvertOperation.cpp new file mode 100644 index 00000000000..d72aabb078e --- /dev/null +++ b/source/blender/compositor/operations/COM_ConvertOperation.cpp @@ -0,0 +1,429 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: + * Jeroen Bakker + * Monique Dewanchand + */ + +#include "COM_ConvertOperation.h" + + +ConvertBaseOperation::ConvertBaseOperation() +{ + this->m_inputOperation = NULL; +} + +void ConvertBaseOperation::initExecution() +{ + this->m_inputOperation = this->getInputSocketReader(0); +} + +void ConvertBaseOperation::deinitExecution() +{ + this->m_inputOperation = NULL; +} + + +/* ******** Value to Color ******** */ + +ConvertValueToColorOperation::ConvertValueToColorOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_VALUE); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertValueToColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputValue[4]; + this->m_inputOperation->read(inputValue, x, y, sampler); + output[0] = output[1] = output[2] = inputValue[0]; + output[3] = 1.0f; +} + + +/* ******** Color to Value ******** */ + +ConvertColorToValueOperation::ConvertColorToValueOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VALUE); +} + +void ConvertColorToValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; +} + + +/* ******** Color to BW ******** */ + +ConvertColorToBWOperation::ConvertColorToBWOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VALUE); +} + +void ConvertColorToBWOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + output[0] = rgb_to_bw(inputColor); +} + + +/* ******** Color to Vector ******** */ + +ConvertColorToVectorOperation::ConvertColorToVectorOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); +} + +void ConvertColorToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + this->m_inputOperation->read(output, x, y, sampler); +} + + +/* ******** Value to Vector ******** */ + +ConvertValueToVectorOperation::ConvertValueToVectorOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_VALUE); + this->addOutputSocket(COM_DT_VECTOR); +} + +void ConvertValueToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float input[4]; + this->m_inputOperation->read(input, x, y, sampler); + output[0] = input[0]; + output[1] = input[0]; + output[2] = input[0]; + output[3] = 0.0f; +} + + +/* ******** Vector to Color ******** */ + +ConvertVectorToColorOperation::ConvertVectorToColorOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_VECTOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertVectorToColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + this->m_inputOperation->read(output, x, y, sampler); + output[3] = 1.0f; +} + + +/* ******** Vector to Value ******** */ + +ConvertVectorToValueOperation::ConvertVectorToValueOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_VECTOR); + this->addOutputSocket(COM_DT_VALUE); +} + +void ConvertVectorToValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float input[4]; + this->m_inputOperation->read(input, x, y, sampler); + output[0] = (input[0] + input[1] + input[2]) / 3.0f; +} + + +/* ******** RGB to YCC ******** */ + +ConvertRGBToYCCOperation::ConvertRGBToYCCOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertRGBToYCCOperation::setMode(int mode) +{ + switch (mode) { + case 1: + this->m_mode = BLI_YCC_ITU_BT709; + break; + case 2: + this->m_mode = BLI_YCC_JFIF_0_255; + break; + case 0: + default: + this->m_mode = BLI_YCC_ITU_BT601; + break; + } +} + +void ConvertRGBToYCCOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + float color[3]; + + this->m_inputOperation->read(inputColor, x, y, sampler); + rgb_to_ycc(inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], this->m_mode); + + /* divided by 255 to normalize for viewing in */ + /* R,G,B --> Y,Cb,Cr */ + mul_v3_v3fl(output, color, 1.0f / 255.0f); + output[3] = inputColor[3]; +} + +/* ******** YCC to RGB ******** */ + +ConvertYCCToRGBOperation::ConvertYCCToRGBOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertYCCToRGBOperation::setMode(int mode) +{ + switch (mode) { + case 1: + this->m_mode = BLI_YCC_ITU_BT709; + break; + case 2: + this->m_mode = BLI_YCC_JFIF_0_255; + break; + case 0: + default: + this->m_mode = BLI_YCC_ITU_BT601; + break; + } +} + +void ConvertYCCToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + + /* need to un-normalize the data */ + /* R,G,B --> Y,Cb,Cr */ + mul_v3_fl(inputColor, 255.0f); + + ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], this->m_mode); + output[3] = inputColor[3]; +} + + +/* ******** RGB to YUV ******** */ + +ConvertRGBToYUVOperation::ConvertRGBToYUVOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertRGBToYUVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]); + output[3] = inputColor[3]; +} + + +/* ******** YUV to RGB ******** */ + +ConvertYUVToRGBOperation::ConvertYUVToRGBOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertYUVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]); + output[3] = inputColor[3]; +} + + +/* ******** RGB to HSV ******** */ + +ConvertRGBToHSVOperation::ConvertRGBToHSVOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertRGBToHSVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + rgb_to_hsv_v(inputColor, output); + output[3] = inputColor[3]; +} + + +/* ******** HSV to RGB ******** */ + +ConvertHSVToRGBOperation::ConvertHSVToRGBOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertHSVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputColor[4]; + this->m_inputOperation->read(inputColor, x, y, sampler); + hsv_to_rgb_v(inputColor, output); + output[3] = inputColor[3]; +} + + +/* ******** Premul to Straight ******** */ + +ConvertPremulToStraightOperation::ConvertPremulToStraightOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertPremulToStraightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputValue[4]; + float alpha; + + this->m_inputOperation->read(inputValue, x, y, sampler); + alpha = inputValue[3]; + + if (fabsf(alpha) < 1e-5f) { + zero_v3(output); + } + else { + mul_v3_v3fl(output, inputValue, 1.0f / alpha); + } + + /* never touches the alpha */ + output[3] = alpha; +} + + +/* ******** Straight to Premul ******** */ + +ConvertStraightToPremulOperation::ConvertStraightToPremulOperation() : ConvertBaseOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); +} + +void ConvertStraightToPremulOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float inputValue[4]; + float alpha; + + this->m_inputOperation->read(inputValue, x, y, sampler); + alpha = inputValue[3]; + + mul_v3_v3fl(output, inputValue, alpha); + + /* never touches the alpha */ + output[3] = alpha; +} + + +/* ******** Separate Channels ******** */ + +SeparateChannelOperation::SeparateChannelOperation() : NodeOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VALUE); + this->m_inputOperation = NULL; +} +void SeparateChannelOperation::initExecution() +{ + this->m_inputOperation = this->getInputSocketReader(0); +} + +void SeparateChannelOperation::deinitExecution() +{ + this->m_inputOperation = NULL; +} + + +void SeparateChannelOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float input[4]; + this->m_inputOperation->read(input, x, y, sampler); + output[0] = input[this->m_channel]; +} + + +/* ******** Combine Channels ******** */ + +CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() +{ + this->addInputSocket(COM_DT_VALUE); + this->addInputSocket(COM_DT_VALUE); + this->addInputSocket(COM_DT_VALUE); + this->addInputSocket(COM_DT_VALUE); + this->addOutputSocket(COM_DT_COLOR); + this->setResolutionInputSocketIndex(0); + this->m_inputChannel1Operation = NULL; + this->m_inputChannel2Operation = NULL; + this->m_inputChannel3Operation = NULL; + this->m_inputChannel4Operation = NULL; +} + +void CombineChannelsOperation::initExecution() +{ + this->m_inputChannel1Operation = this->getInputSocketReader(0); + this->m_inputChannel2Operation = this->getInputSocketReader(1); + this->m_inputChannel3Operation = this->getInputSocketReader(2); + this->m_inputChannel4Operation = this->getInputSocketReader(3); +} + +void CombineChannelsOperation::deinitExecution() +{ + this->m_inputChannel1Operation = NULL; + this->m_inputChannel2Operation = NULL; + this->m_inputChannel3Operation = NULL; + this->m_inputChannel4Operation = NULL; +} + + +void CombineChannelsOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float input[4]; + if (this->m_inputChannel1Operation) { + this->m_inputChannel1Operation->read(input, x, y, sampler); + output[0] = input[0]; + } + if (this->m_inputChannel2Operation) { + this->m_inputChannel2Operation->read(input, x, y, sampler); + output[1] = input[0]; + } + if (this->m_inputChannel3Operation) { + this->m_inputChannel3Operation->read(input, x, y, sampler); + output[2] = input[0]; + } + if (this->m_inputChannel4Operation) { + this->m_inputChannel4Operation->read(input, x, y, sampler); + output[3] = input[0]; + } +} diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h new file mode 100644 index 00000000000..06aeb2e52d7 --- /dev/null +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -0,0 +1,202 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: + * Jeroen Bakker + * Monique Dewanchand + */ + +#ifndef _COM_ConvertOperation_h +#define _COM_ConvertOperation_h + +#include "COM_NodeOperation.h" + + +class ConvertBaseOperation : public NodeOperation { +protected: + SocketReader *m_inputOperation; + +public: + ConvertBaseOperation(); + + void initExecution(); + void deinitExecution(); +}; + + +class ConvertValueToColorOperation : public ConvertBaseOperation { +public: + ConvertValueToColorOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertColorToValueOperation : public ConvertBaseOperation { +public: + ConvertColorToValueOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertColorToBWOperation : public ConvertBaseOperation { +public: + ConvertColorToBWOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertColorToVectorOperation : public ConvertBaseOperation { +public: + ConvertColorToVectorOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertValueToVectorOperation : public ConvertBaseOperation { +public: + ConvertValueToVectorOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertVectorToColorOperation : public ConvertBaseOperation { +public: + ConvertVectorToColorOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertVectorToValueOperation : public ConvertBaseOperation { +public: + ConvertVectorToValueOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertRGBToYCCOperation : public ConvertBaseOperation { +private: + /** YCbCr mode (Jpeg, ITU601, ITU709) */ + int m_mode; +public: + ConvertRGBToYCCOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); + + /** Set the YCC mode */ + void setMode(int mode); +}; + + +class ConvertYCCToRGBOperation : public ConvertBaseOperation { +private: + /** YCbCr mode (Jpeg, ITU601, ITU709) */ + int m_mode; +public: + ConvertYCCToRGBOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); + + /** Set the YCC mode */ + void setMode(int mode); +}; + + +class ConvertRGBToYUVOperation : public ConvertBaseOperation { +public: + ConvertRGBToYUVOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertYUVToRGBOperation : public ConvertBaseOperation { +public: + ConvertYUVToRGBOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertRGBToHSVOperation : public ConvertBaseOperation { +public: + ConvertRGBToHSVOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertHSVToRGBOperation : public ConvertBaseOperation { +public: + ConvertHSVToRGBOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertPremulToStraightOperation : public ConvertBaseOperation { +public: + ConvertPremulToStraightOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class ConvertStraightToPremulOperation : public ConvertBaseOperation { +public: + ConvertStraightToPremulOperation(); + + void executePixel(float output[4], float x, float y, PixelSampler sampler); +}; + + +class SeparateChannelOperation : public NodeOperation { +private: + SocketReader *m_inputOperation; + int m_channel; +public: + SeparateChannelOperation(); + void executePixel(float output[4], float x, float y, PixelSampler sampler); + + void initExecution(); + void deinitExecution(); + + void setChannel(int channel) { this->m_channel = channel; } +}; + + +class CombineChannelsOperation : public NodeOperation { +private: + SocketReader *m_inputChannel1Operation; + SocketReader *m_inputChannel2Operation; + SocketReader *m_inputChannel3Operation; + SocketReader *m_inputChannel4Operation; +public: + CombineChannelsOperation(); + void executePixel(float output[4], float x, float y, PixelSampler sampler); + + void initExecution(); + void deinitExecution(); +}; + +#endif diff --git a/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.cpp deleted file mode 100644 index 2af4b55de1a..00000000000 --- a/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertPremulToStraightOperation.h" -#include "BLI_math.h" - -ConvertPremulToStraightOperation::ConvertPremulToStraightOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - - this->m_inputColor = NULL; -} - -void ConvertPremulToStraightOperation::initExecution() -{ - this->m_inputColor = getInputSocketReader(0); -} - -void ConvertPremulToStraightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputValue[4]; - float alpha; - - this->m_inputColor->read(inputValue, x, y, sampler); - alpha = inputValue[3]; - - if (fabsf(alpha) < 1e-5f) { - zero_v3(output); - } - else { - mul_v3_v3fl(output, inputValue, 1.0f / alpha); - } - - /* never touches the alpha */ - output[3] = alpha; -} - -void ConvertPremulToStraightOperation::deinitExecution() -{ - this->m_inputColor = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.h b/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.h deleted file mode 100644 index 9d3ab156555..00000000000 --- a/source/blender/compositor/operations/COM_ConvertPremulToStraightOperation.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2012, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertPremulToStraightOperation_h -#define _COM_ConvertPremulToStraightOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertPremulToStraightOperation : public NodeOperation { -private: - SocketReader *m_inputColor; -public: - /** - * Default constructor - */ - ConvertPremulToStraightOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - void initExecution(); - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp deleted file mode 100644 index 3c7a9d5fd50..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertRGBToHSVOperation.h" -#include "BLI_math_color.h" - -ConvertRGBToHSVOperation::ConvertRGBToHSVOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertRGBToHSVOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertRGBToHSVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - rgb_to_hsv_v(inputColor, output); - output[3] = inputColor[3]; -} - -void ConvertRGBToHSVOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h deleted file mode 100644 index fdc8dfed31b..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertRGBToHSVOperation_h -#define _COM_ConvertRGBToHSVOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertRGBToHSVOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertRGBToHSVOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp deleted file mode 100644 index 6f6dffdc72b..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertRGBToYCCOperation.h" -#include "BLI_math_color.h" - -ConvertRGBToYCCOperation::ConvertRGBToYCCOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertRGBToYCCOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertRGBToYCCOperation::setMode(int mode) -{ - switch (mode) { - case 1: - this->m_mode = BLI_YCC_ITU_BT709; - break; - case 2: - this->m_mode = BLI_YCC_JFIF_0_255; - break; - case 0: - default: - this->m_mode = BLI_YCC_ITU_BT601; - break; - } -} - -void ConvertRGBToYCCOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - float color[3]; - - this->m_inputOperation->read(inputColor, x, y, sampler); - rgb_to_ycc(inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], this->m_mode); - - /* divided by 255 to normalize for viewing in */ - /* R,G,B --> Y,Cb,Cr */ - mul_v3_v3fl(output, color, 1.0f / 255.0f); - output[3] = inputColor[3]; -} - -void ConvertRGBToYCCOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h deleted file mode 100644 index 3f85555f3bb..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertRGBToYCCOperation_h -#define _COM_ConvertRGBToYCCOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertRGBToYCCOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; - - /** - * YCbCr mode (Jpeg, ITU601, ITU709) - */ - int m_mode; -public: - /** - * Default constructor - */ - ConvertRGBToYCCOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - - /** - * Set the YCC mode - */ - void setMode(int mode); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp deleted file mode 100644 index 8ce9e150080..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertRGBToYUVOperation.h" -#include "BLI_math_color.h" - -ConvertRGBToYUVOperation::ConvertRGBToYUVOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertRGBToYUVOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertRGBToYUVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]); - output[3] = inputColor[3]; -} - -void ConvertRGBToYUVOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h deleted file mode 100644 index 97d57f657ec..00000000000 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertRGBToYUVOperation_h -#define _COM_ConvertRGBToYUVOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertRGBToYUVOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertRGBToYUVOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.cpp b/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.cpp deleted file mode 100644 index ae55d949ff2..00000000000 --- a/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertStraightToPremulOperation.h" -#include "BLI_math.h" - -ConvertStraightToPremulOperation::ConvertStraightToPremulOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - - this->m_inputColor = NULL; -} - -void ConvertStraightToPremulOperation::initExecution() -{ - this->m_inputColor = getInputSocketReader(0); -} - -void ConvertStraightToPremulOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputValue[4]; - float alpha; - - this->m_inputColor->read(inputValue, x, y, sampler); - alpha = inputValue[3]; - - mul_v3_v3fl(output, inputValue, alpha); - - /* never touches the alpha */ - output[3] = alpha; -} - -void ConvertStraightToPremulOperation::deinitExecution() -{ - this->m_inputColor = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.h b/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.h deleted file mode 100644 index d0191f292d2..00000000000 --- a/source/blender/compositor/operations/COM_ConvertStraightToPremulOperation.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertStraightToPremulOperation_h -#define _COM_ConvertStraightToPremulOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertStraightToPremulOperation : public NodeOperation { -private: - SocketReader *m_inputColor; -public: - /** - * Default constructor - */ - ConvertStraightToPremulOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - void initExecution(); - void deinitExecution(); - -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp deleted file mode 100644 index 98e7650aa56..00000000000 --- a/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertValueToColorProg.h" - -ConvertValueToColorProg::ConvertValueToColorProg() : NodeOperation() -{ - this->addInputSocket(COM_DT_VALUE); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; -} -void ConvertValueToColorProg::initExecution() -{ - this->m_inputProgram = this->getInputSocketReader(0); -} - -void ConvertValueToColorProg::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputValue[4]; - this->m_inputProgram->read(inputValue, x, y, sampler); - output[0] = output[1] = output[2] = inputValue[0]; - output[3] = 1.0f; -} - -void ConvertValueToColorProg::deinitExecution() -{ - this->m_inputProgram = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertValueToColorProg.h b/source/blender/compositor/operations/COM_ConvertValueToColorProg.h deleted file mode 100644 index f0f6cfb8fd2..00000000000 --- a/source/blender/compositor/operations/COM_ConvertValueToColorProg.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertValueToColorProg_h -#define _COM_ConvertValueToColorProg_h -#include "COM_NodeOperation.h" - - -class ConvertValueToColorProg : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputProgram; -public: - ConvertValueToColorProg(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp deleted file mode 100644 index 411409d263c..00000000000 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertValueToVectorOperation.h" - -ConvertValueToVectorOperation::ConvertValueToVectorOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_VALUE); - this->addOutputSocket(COM_DT_VECTOR); - this->m_inputOperation = NULL; -} - -void ConvertValueToVectorOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertValueToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float input[4]; - this->m_inputOperation->read(input, x, y, sampler); - output[0] = input[0]; - output[1] = input[0]; - output[2] = input[0]; - output[3] = 0.0f; -} - -void ConvertValueToVectorOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h deleted file mode 100644 index da45848ca34..00000000000 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertValueToVectorOperation_h -#define _COM_ConvertValueToVectorOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertValueToVectorOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertValueToVectorOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp deleted file mode 100644 index 78cb706c32d..00000000000 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertVectorToColorOperation.h" - -ConvertVectorToColorOperation::ConvertVectorToColorOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_VECTOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertVectorToColorOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertVectorToColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - this->m_inputOperation->read(output, x, y, sampler); - output[3] = 1.0f; -} - -void ConvertVectorToColorOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h deleted file mode 100644 index 9ef5f8fece3..00000000000 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertVectorToColorOperation_h -#define _COM_ConvertVectorToColorOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertVectorToColorOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertVectorToColorOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp deleted file mode 100644 index a3612414029..00000000000 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_ConvertVectorToValueOperation.h" - -ConvertVectorToValueOperation::ConvertVectorToValueOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_VECTOR); - this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; -} - -void ConvertVectorToValueOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertVectorToValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float input[4]; - this->m_inputOperation->read(input, x, y, sampler); - output[0] = (input[0] + input[1] + input[2]) / 3.0f; -} - -void ConvertVectorToValueOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h deleted file mode 100644 index e42f235a12b..00000000000 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_ConvertVectorToValueOperation_h -#define _COM_ConvertVectorToValueOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertVectorToValueOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertVectorToValueOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp deleted file mode 100644 index 8f9eaf49ea4..00000000000 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertYCCToRGBOperation.h" -#include "BLI_math_color.h" - -ConvertYCCToRGBOperation::ConvertYCCToRGBOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertYCCToRGBOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertYCCToRGBOperation::setMode(int mode) -{ - switch (mode) { - case 1: - this->m_mode = BLI_YCC_ITU_BT709; - break; - case 2: - this->m_mode = BLI_YCC_JFIF_0_255; - break; - case 0: - default: - this->m_mode = BLI_YCC_ITU_BT601; - break; - } -} - -void ConvertYCCToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - - /* need to un-normalize the data */ - /* R,G,B --> Y,Cb,Cr */ - mul_v3_fl(inputColor, 255.0f); - - ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], this->m_mode); - output[3] = inputColor[3]; -} - -void ConvertYCCToRGBOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} - diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h deleted file mode 100644 index 0a8b67e0bee..00000000000 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertYCCToRGBOperation_h -#define _COM_ConvertYCCToRGBOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertYCCToRGBOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; - - /** - * YCbCr mode (Jpeg, ITU601, ITU709) - */ - int m_mode; -public: - /** - * Default constructor - */ - ConvertYCCToRGBOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); - - /** - * Set the YCC mode - */ - void setMode(int mode); -}; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp deleted file mode 100644 index 197c7f9f043..00000000000 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#include "COM_ConvertYUVToRGBOperation.h" -#include "BLI_math_color.h" - -ConvertYUVToRGBOperation::ConvertYUVToRGBOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; -} - -void ConvertYUVToRGBOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void ConvertYUVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float inputColor[4]; - this->m_inputOperation->read(inputColor, x, y, sampler); - yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]); - output[3] = inputColor[3]; -} - -void ConvertYUVToRGBOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} - diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h deleted file mode 100644 index ee11ef8df60..00000000000 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Dalai Felinto - */ - -#ifndef _COM_ConvertYUVToRGBOperation_h -#define _COM_ConvertYUVToRGBOperation_h -#include "COM_NodeOperation.h" - - -/** - * this program converts an input color to an output value. - * it assumes we are in sRGB color space. - */ -class ConvertYUVToRGBOperation : public NodeOperation { -private: - /** - * Cached reference to the inputProgram - */ - SocketReader *m_inputOperation; -public: - /** - * Default constructor - */ - ConvertYUVToRGBOperation(); - - /** - * the inner loop of this program - */ - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - /** - * Initialize the execution - */ - void initExecution(); - - /** - * Deinitialize the execution - */ - void deinitExecution(); -}; -#endif diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp deleted file mode 100644 index 9fc266cce86..00000000000 --- a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#include "COM_SeparateChannelOperation.h" - -SeparateChannelOperation::SeparateChannelOperation() : NodeOperation() -{ - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; -} -void SeparateChannelOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void SeparateChannelOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} - - -void SeparateChannelOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) -{ - float input[4]; - this->m_inputOperation->read(input, x, y, sampler); - output[0] = input[this->m_channel]; -} diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.h b/source/blender/compositor/operations/COM_SeparateChannelOperation.h deleted file mode 100644 index f964df5df02..00000000000 --- a/source/blender/compositor/operations/COM_SeparateChannelOperation.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor: - * Jeroen Bakker - * Monique Dewanchand - */ - -#ifndef _COM_SeparateChannelOperation_h_ -#define _COM_SeparateChannelOperation_h_ - -#include "COM_NodeOperation.h" - -class SeparateChannelOperation : public NodeOperation { -private: - SocketReader *m_inputOperation; - int m_channel; -public: - SeparateChannelOperation(); - void executePixel(float output[4], float x, float y, PixelSampler sampler); - - void initExecution(); - void deinitExecution(); - - void setChannel(int channel) { this->m_channel = channel; } -}; - -#endif |