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 /source/blender/compositor/operations | |
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).
Diffstat (limited to 'source/blender/compositor/operations')
36 files changed, 631 insertions, 1864 deletions
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 |