Page Menu
Home
Search
Configure Global Search
Log In
Files
F26674
deband.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Björn Sonnenschein (sunboy)
Nov 13 2013, 5:37 PM
Size
19 KB
Subscribers
None
deband.diff
View Options
Index: /home/sun/Software/BlenderMod/blender/source/blender/nodes/NOD_composite.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/nodes/NOD_composite.h (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/nodes/NOD_composite.h (working copy)
@@ -81,6 +81,7 @@
void register_node_type_cmp_dilateerode(struct bNodeTreeType *ttype);
void register_node_type_cmp_inpaint(struct bNodeTreeType *ttype);
void register_node_type_cmp_despeckle(struct bNodeTreeType *ttype);
+void register_node_type_cmp_deband(struct bNodeTreeType *ttype);
void register_node_type_cmp_defocus(struct bNodeTreeType *ttype);
void register_node_type_cmp_valtorgb(struct bNodeTreeType *ttype);
Index: /home/sun/Software/BlenderMod/blender/source/blender/nodes/CMakeLists.txt
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/nodes/CMakeLists.txt (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/nodes/CMakeLists.txt (working copy)
@@ -62,6 +62,7 @@
composite/nodes/node_composite_despeckle.c
composite/nodes/node_composite_doubleEdgeMask.c
composite/nodes/node_composite_defocus.c
+ composite/nodes/node_composite_deband.c
composite/nodes/node_composite_diffMatte.c
composite/nodes/node_composite_dilate.c
composite/nodes/node_composite_directionalblur.c
Index: /home/sun/Software/BlenderMod/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/editors/space_node/drawnode.c (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/editors/space_node/drawnode.c (working copy)
@@ -2520,6 +2520,16 @@
uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NONE);
}
+static void node_composit_buts_deband(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+
+ uiLayout *col;
+
+ col = uiLayoutColumn(layout, FALSE);
+ uiItemR(layout, ptr, "use_singlechannel", 0, NULL, ICON_NONE);
+ // uiItemR(layout, ptr, "f_stop", 0, NULL, ICON_NONE); // UNUSED
+}
+
static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
{
// node_composit_backdrop_canvas(snode, backdrop, node, x, y);
@@ -2890,6 +2900,9 @@
case CMP_NODE_INVERT:
ntype->uifunc = node_composit_buts_invert;
break;
+ case CMP_NODE_DEBAND:
+ ntype->uifunc = node_composit_buts_deband;
+ break;
case CMP_NODE_PREMULKEY:
ntype->uifunc = node_composit_buts_premulkey;
break;
Index: /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/BKE_node.h (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/BKE_node.h (working copy)
@@ -694,6 +694,7 @@
#define CMP_NODE_TRACKPOS 271
#define CMP_NODE_INPAINT 272
#define CMP_NODE_DESPECKLE 273
+#define CMP_NODE_DEBAND 274
#define CMP_NODE_GLARE 301
#define CMP_NODE_TONEMAP 302
Index: /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/intern/node.c (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/blenkernel/intern/node.c (working copy)
@@ -2226,6 +2226,7 @@
register_node_type_cmp_inpaint(ttype);
register_node_type_cmp_despeckle(ttype);
register_node_type_cmp_defocus(ttype);
+ register_node_type_cmp_deband(ttype);
register_node_type_cmp_valtorgb(ttype);
register_node_type_cmp_rgbtobw(ttype);
Index: /home/sun/Software/BlenderMod/blender/source/blender/makesdna/DNA_node_types.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/makesdna/DNA_node_types.h (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/makesdna/DNA_node_types.h (working copy)
@@ -425,6 +425,12 @@
int pad;
} ColorCorrectionData;
+typedef struct Deband {
+ float treshold;
+ float radius;
+} DebandData;
+
+
typedef struct NodeColorCorrection {
ColorCorrectionData master;
ColorCorrectionData shadows;
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.h (revision 0)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.h (working copy)
@@ -0,0 +1,38 @@
+/*
+ * 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_DebandNode_h_
+#define _COM_DebandNode_h_
+
+#include "COM_Node.h"
+
+/**
+ * @brief DebandNode
+ * @ingroup Node
+ */
+class DebandNode : public Node {
+public:
+ DebandNode(bNode *editorNode);
+ void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+};
+
+#endif
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.cpp
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.cpp (revision 0)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/nodes/COM_DebandNode.cpp (working copy)
@@ -0,0 +1,43 @@
+/*
+ * 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_DebandNode.h"
+#include "COM_DebandOperation.h"
+#include "COM_ExecutionSystem.h"
+
+DebandNode::DebandNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
+
+void DebandNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+ DebandOperation *operation = new DebandOperation();
+ bNode *node = this->getbNode();
+ operation->setSinglechannel(node->custom1);
+
+ this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+ this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
+ this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
+ this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+}
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/CMakeLists.txt
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/CMakeLists.txt (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/CMakeLists.txt (working copy)
@@ -291,7 +291,9 @@
nodes/COM_FilterNode.cpp
nodes/COM_FilterNode.h
nodes/COM_DespeckleNode.cpp
- nodes/COM_DespeckleNode.h
+ nodes/COM_DespeckleNode.h
+ nodes/COM_DebandNode.cpp
+ nodes/COM_DebandNode.h
nodes/COM_DilateErodeNode.cpp
nodes/COM_DilateErodeNode.h
nodes/COM_InpaintNode.cpp
@@ -314,6 +316,8 @@
operations/COM_GaussianBokehBlurOperation.h
operations/COM_BokehBlurOperation.cpp
operations/COM_BokehBlurOperation.h
+ operations/COM_DebandOperation.cpp
+ operations/COM_DebandOperation.h
operations/COM_VariableSizeBokehBlurOperation.cpp
operations/COM_VariableSizeBokehBlurOperation.h
operations/COM_FastGaussianBlurOperation.cpp
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/intern/COM_Converter.cpp (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/intern/COM_Converter.cpp (working copy)
@@ -61,6 +61,7 @@
#include "COM_DilateErodeNode.h"
#include "COM_DirectionalBlurNode.h"
#include "COM_DisplaceNode.h"
+#include "COM_DebandNode.h"
#include "COM_DistanceMatteNode.h"
#include "COM_DoubleEdgeMaskNode.h"
#include "COM_EllipseMaskNode.h"
@@ -313,6 +314,11 @@
case CMP_NODE_DESPECKLE:
node = new DespeckleNode(b_node);
break;
+
+ case CMP_NODE_DEBAND:
+ node = new DebandNode(b_node);
+ break;
+
case CMP_NODE_LENSDIST:
node = new LensDistortionNode(b_node);
break;
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.h (revision 0)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.h (working copy)
@@ -0,0 +1,60 @@
+/*
+ * 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_DebandOperation_h
+#define _COM_DebandOperation_h
+#include "COM_NodeOperation.h"
+
+
+class DebandOperation : public NodeOperation {
+private:
+ /**
+ * Cached reference to the inputProgram
+ */
+ SocketReader *m_inputProgram;
+ SocketReader *m_inputTresholdProgram;
+ SocketReader *m_inputRadiusProgram;
+
+ bool m_singlechannel;
+
+public:
+ DebandOperation();
+
+ /**
+ * 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();
+
+ void setSinglechannel(bool singlechannel) { this->m_singlechannel = singlechannel; }
+
+};
+#endif
Index: /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.cpp
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.cpp (revision 0)
+++ /home/sun/Software/BlenderMod/blender/source/blender/compositor/operations/COM_DebandOperation.cpp (working copy)
@@ -0,0 +1,178 @@
+/*
+ * 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_DebandOperation.h"
+#include "BLI_math_color.h"
+
+DebandOperation::DebandOperation() : NodeOperation()
+{
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->m_inputProgram = NULL;
+ this->setSinglechannel(false);
+}
+void DebandOperation::initExecution()
+{
+ this->m_inputProgram = this->getInputSocketReader(0);
+ this->m_inputTresholdProgram = this->getInputSocketReader(1);
+ this->m_inputRadiusProgram = this->getInputSocketReader(2);
+}
+
+void DebandOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+ float v[4];
+ float inputTreshold[4];
+ float inputRadius[4];
+
+ this->m_inputProgram->read(v, x, y, sampler);
+ this->m_inputTresholdProgram->read(inputTreshold, x, y, sampler);
+ this->m_inputRadiusProgram->read(inputRadius, x, y, sampler);
+
+ float treshold = inputTreshold[0];
+ float radius = inputRadius[0];
+ int channels;
+ treshold /= 100.0f;
+
+ int i, j;
+ int changex = 0, changey = 0;
+ float valuex[4], valuey[4];
+ float v2[4];
+ int position2;
+
+ if (this->m_singlechannel) {
+ channels = 1; }
+
+ else {
+ channels = 3; }
+
+ for (i=0; i < channels; i++) {
+
+ changex = 0;
+ changey = 0;
+ valuex[i] = 0;
+ valuey[i] = 0;
+
+ /*HöherX*/
+ for (j = 1; j<= radius; j++){
+
+ position2 = x + j;
+
+ this->m_inputProgram->read(v2, position2, y, sampler);
+
+ if ((v[i] - v2[i]) * (v[i] - v2[i]) < treshold * treshold) {
+ valuex[i] += v2[i];
+ changex++;
+ }
+
+ else {
+
+ break; }
+ }
+
+ /*NiedrigerX*/
+ for (j = 1; j<= radius; j++){
+
+ position2 = x - j;
+
+ this->m_inputProgram->read(v2, position2, y, sampler);
+
+ if ((v[i] - v2[i]) * (v[i] - v2[i]) < treshold * treshold) {
+ valuex[i] += v2[i];
+ changex++;
+ }
+
+ else {
+ break; }
+ }
+
+ /*HöherY*/
+ for (j = 1; j<= radius; j++){
+
+ position2 = y + j;
+
+ this->m_inputProgram->read(v2, x, position2, sampler);
+
+ if ((v[i] - v2[i]) * (v[i] - v2[i]) < treshold * treshold) {
+ valuey[i] += v2[i];
+ changey++;
+ }
+
+ else {
+
+ break; }
+ }
+
+ /*NiedrigerY*/
+ for (j = 1; j<= radius; j++){
+
+ position2 = y - j;
+
+ this->m_inputProgram->read(v2, x, position2, sampler);
+
+ if ((v[i] - v2[i]) * (v[i] - v2[i]) < treshold * treshold) {
+ valuey[i] += v2[i];
+ changey++;
+ }
+
+ else {
+ break; }
+ }
+
+ if ((changex >= 2) && (changey >= 2)) {
+
+ v[i] = (valuex[i] + valuey[i] + v[i]) / (changex + changey + 1);
+ }
+
+ else if (changex >= 2) {
+
+ v[i] = (valuex[i] + v[i]) / (changex + 1);
+ }
+
+ else if (changey >= 2) {
+
+ v[i] = (valuey[i] + v[i]) / (changey + 1);
+ }
+
+ }
+
+ output[0] = v[0];
+
+ if (this->m_singlechannel) {
+ output[1] = v[0];
+ output[2] = v[0];
+ output[3] = v[0];}
+
+ else {
+ output[1] = v[1];
+ output[2] = v[2];
+ output[3] = v[3];}
+}
+
+void DebandOperation::deinitExecution()
+{
+ this->m_inputProgram = NULL;
+ this->m_inputTresholdProgram = NULL;
+ this->m_inputRadiusProgram = NULL;
+}
+
Index: /home/sun/Software/BlenderMod/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/makesrna/RNA_access.h (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/makesrna/RNA_access.h (working copy)
@@ -130,6 +130,7 @@
extern StructRNA RNA_CompositorNodeCurveRGB;
extern StructRNA RNA_CompositorNodeCurveVec;
extern StructRNA RNA_CompositorNodeDBlur;
+extern StructRNA RNA_CompositorNodeDeband;
extern StructRNA RNA_CompositorNodeDefocus;
extern StructRNA RNA_CompositorNodeDiffMatte;
extern StructRNA RNA_CompositorNodeDilateErode;
Index: /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree_types.h
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree_types.h (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree_types.h (working copy)
@@ -154,6 +154,7 @@
DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" )
DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" )
+DefNode( CompositorNode, CMP_NODE_DEBAND, def_cmp_deband, "DEBAND", Deband, "Deband", "" )
DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" )
DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )
Index: /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree.c (revision 53877)
+++ /home/sun/Software/BlenderMod/blender/source/blender/makesrna/intern/rna_nodetree.c (working copy)
@@ -3873,6 +3873,15 @@
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_cmp_deband(StructRNA *srna)
+{
+ PropertyRNA *prop;
+ prop = RNA_def_property(srna, "use_singlechannel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
+ RNA_def_property_ui_text(prop, "Single Channel", "Support variable blue per-pixel when using an image for size input");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
static void def_cmp_colorcorrection(StructRNA *srna)
{
PropertyRNA *prop;
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4e/d7/7e0292d1619c43ac13c9229af0fc
Event Timeline
Log In to Comment