[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32912] branches/particles-2010/source/ blender/nodes/intern: Partially reverted r31887 to the trunk folder structure in source/blender/ nodes.

Lukas Toenne lukas.toenne at googlemail.com
Sun Nov 7 11:22:34 CET 2010


Revision: 32912
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32912
Author:   lukastoenne
Date:     2010-11-07 11:22:34 +0100 (Sun, 07 Nov 2010)

Log Message:
-----------
Partially reverted r31887 to the trunk folder structure in source/blender/nodes. The new folders are only a minor improvement in that state and make merging too tedious. If at all, this should be done at some later time after merging the branch to trunk, so changes to the node trees don't need to be manually merged every time.

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_image.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_math.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_value.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/Makefile
    branches/particles-2010/source/blender/nodes/intern/CMP_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/CMP_util.c
    branches/particles-2010/source/blender/nodes/intern/CMP_util.h
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/Makefile
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_material.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_math.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_output.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_value.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/SHD_util.c
    branches/particles-2010/source/blender/nodes/intern/SHD_util.h
    branches/particles-2010/source/blender/nodes/intern/SIM_intern.c
    branches/particles-2010/source/blender/nodes/intern/SIM_intern.h
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_add_particle.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_add_particle_force.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_debugprint.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_filter.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_for.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_for_group.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_if.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_particle_dynamics.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_pass.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_program.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_random.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_subprogram.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_timestep.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_vectormath.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_while.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.h
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/Makefile
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_at.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_compose.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_image.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_math.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_output.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/TEX_util.c
    branches/particles-2010/source/blender/nodes/intern/TEX_util.h

Removed Paths:
-------------
    branches/particles-2010/source/blender/nodes/intern/composite/
    branches/particles-2010/source/blender/nodes/intern/shader/
    branches/particles-2010/source/blender/nodes/intern/simulation/
    branches/particles-2010/source/blender/nodes/intern/texture/

Copied: branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c (from rev 32911, branches/particles-2010/source/blender/nodes/intern/composite/nodes/CMP_alphaOver.c)
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c	2010-11-07 10:22:34 UTC (rev 32912)
@@ -0,0 +1,161 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../CMP_util.h"
+
+/* **************** ALPHAOVER ******************** */
+static bNodeSocketDefinition cmp_node_alphaover_in[]= {
+	{	SOCK_VALUE, 1, "Fac",			1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+	{	SOCK_RGBA, 1, "Image",			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+	{	SOCK_RGBA, 1, "Image",			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+static bNodeSocketDefinition cmp_node_alphaover_out[]= {
+	{	SOCK_RGBA, 0, "Image",			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+
+static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac)
+{
+	
+	if(over[3]<=0.0f) {
+		QUATCOPY(out, src);
+	}
+	else if(fac[0]==1.0f && over[3]>=1.0f) {
+		QUATCOPY(out, over);
+	}
+	else {
+		float mul= 1.0f - fac[0]*over[3];
+
+		out[0]= (mul*src[0]) + fac[0]*over[0];
+		out[1]= (mul*src[1]) + fac[0]*over[1];
+		out[2]= (mul*src[2]) + fac[0]*over[2];
+		out[3]= (mul*src[3]) + fac[0]*over[3];
+	}	
+}
+
+/* result will be still premul, but the over part is premulled */
+static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac)
+{
+	
+	if(over[3]<=0.0f) {
+		QUATCOPY(out, src);
+	}
+	else if(fac[0]==1.0f && over[3]>=1.0f) {
+		QUATCOPY(out, over);
+	}
+	else {
+		float premul= fac[0]*over[3];
+		float mul= 1.0f - premul;
+
+		out[0]= (mul*src[0]) + premul*over[0];
+		out[1]= (mul*src[1]) + premul*over[1];
+		out[2]= (mul*src[2]) + premul*over[2];
+		out[3]= (mul*src[3]) + fac[0]*over[3];
+	}
+}
+
+/* result will be still premul, but the over part is premulled */
+static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, float *fac)
+{
+	
+	if(over[3]<=0.0f) {
+		QUATCOPY(out, src);
+	}
+	else if(fac[0]==1.0f && over[3]>=1.0f) {
+		QUATCOPY(out, over);
+	}
+	else {
+		NodeTwoFloats *ntf= node->storage;
+		float addfac= 1.0f - ntf->x + over[3]*ntf->x;
+		float premul= fac[0]*addfac;
+		float mul= 1.0f - fac[0]*over[3];
+		
+		out[0]= (mul*src[0]) + premul*over[0];
+		out[1]= (mul*src[1]) + premul*over[1];
+		out[2]= (mul*src[2]) + premul*over[2];
+		out[3]= (mul*src[3]) + fac[0]*over[3];
+	}
+}
+
+
+
+
+static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+	/* stack order in: col col */
+	/* stack order out: col */
+	if(out[0]->hasoutput==0) 
+		return;
+	
+	/* input no image? then only color operation */
+	if(in[1]->data==NULL && in[2]->data==NULL) {
+		do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec);
+	}
+	else {
+		/* make output size of input image */
+		CompBuf *cbuf= in[1]->data?in[1]->data:in[2]->data;
+		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
+		NodeTwoFloats *ntf= node->storage;
+		
+		if(ntf->x != 0.0f)
+			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_mixed, CB_RGBA, CB_RGBA, CB_VAL);
+		else if(node->custom1)
+			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_key, CB_RGBA, CB_RGBA, CB_VAL);
+		else
+			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL);
+		
+		out[0]->data= stackbuf;
+	}
+}
+
+static void node_alphaover_init(bNode* node)
+{
+   node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
+}
+
+bNodeType cmp_node_alphaover= {
+	/* *next,*prev */	NULL, NULL,
+	/* type code   */	CMP_NODE_ALPHAOVER,
+	/* name        */	"AlphaOver",
+	/* width+range */	80, 40, 120,
+	/* class+opts  */	NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+	/* input sock  */	cmp_node_alphaover_in,
+	/* output sock */	cmp_node_alphaover_out,
+	/* storage     */	"NodeTwoFloats",
+	/* execfunc    */	node_composit_exec_alphaover,
+	/* butfunc     */	NULL,
+	/* initfunc    */	node_alphaover_init,
+	/* freestoragefunc    */	node_free_standard_storage,
+	/* copystoragefunc    */	node_copy_standard_storage,
+	/* id          */	NULL
+	
+};
+
+

Copied: branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c (from rev 32911, branches/particles-2010/source/blender/nodes/intern/composite/nodes/CMP_bilateralblur.c)
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c	2010-11-07 10:22:34 UTC (rev 32912)
@@ -0,0 +1,269 @@
+/**
+ *
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Vilem Novak
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include "../CMP_util.h"
+
+/* **************** BILATERALBLUR ******************** */
+static bNodeSocketDefinition cmp_node_bilateralblur_in[]= {
+	{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, 
+	{ SOCK_RGBA, 1, "Determinator", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, 
+	{ -1, 0, "" } 
+};
+
+static bNodeSocketDefinition cmp_node_bilateralblur_out[]= { 
+	{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, 
+	{ -1, 0, "" } 
+};
+
+#define INIT_C3\
+	mean0 = 1; mean1[0] = src[0];mean1[1] = src[1];mean1[2] = src[2];mean1[3] = src[3];
+
+/* finds color distances */
+#define COLOR_DISTANCE_C3(c1, c2)\
+	((c1[0] - c2[0])*(c1[0] - c2[0]) + \
+	(c1[1] - c2[1])*(c1[1] - c2[1]) + \
+	(c1[2] - c2[2])*(c1[2] - c2[2]) + \
+	(c1[3] - c2[3])*(c1[3] - c2[3]))
+
+/* this is the main kernel function for comparing color distances
+ and adding them weighted to the final color */
+#define KERNEL_ELEMENT_C3(k)\
+	temp_color = src + deltas[k];\
+	ref_color = ref + deltas[k];\
+	w = weight_tab[k] + COLOR_DISTANCE_C3(ref, ref_color )*i2sigma_color;\
+	w = 1./(w*w + 1); \
+	mean0 += w;\
+	mean1[0] += temp_color[0]*w; \
+	mean1[1] += temp_color[1]*w; \
+	mean1[2] += temp_color[2]*w; \
+	mean1[3] += temp_color[3]*w;
+
+/* write blurred values to image */
+#define UPDATE_OUTPUT_C3\
+	mean0 = 1./mean0;\
+	dest[x*pix + 0] = mean1[0]*mean0; \
+	dest[x*pix + 1] = mean1[1]*mean0; \
+	dest[x*pix + 2] = mean1[2]*mean0; \
+	dest[x*pix + 3] = mean1[3]*mean0;
+
+/* initializes deltas for fast access to neighbour pixels */
+#define INIT_3X3_DELTAS( deltas, step, nch )            \
+	((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
+	(deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
+	(deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
+	(deltas)[6] =  (step), (deltas)[7] =  (step) + (nch));
+
+
+/* code of this node was heavily inspired by the smooth function of opencv library.
+The main change is an optional image input */
+static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+	NodeBilateralBlurData *nbbd= node->storage;
+	CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data;
+	double mean0, w, i2sigma_color, i2sigma_space;
+	double mean1[4];
+	double weight_tab[8];
+	float *src, *dest, *ref, *temp_color, *ref_color;
+	float sigma_color, sigma_space;
+	int imgx, imgy, x, y, pix, i, step;
+	int deltas[8];
+	short found_determinator= 0;
+
+	if(img == NULL || out[0]->hasoutput == 0)
+		return;
+
+	if(img->type != CB_RGBA) {
+		img= typecheck_compbuf(in[0]->data, CB_RGBA);
+	}
+
+	imgx= img->x;
+	imgy= img->y;
+	pix= img->type;
+	step= pix * imgx;
+
+	if(refimg) {
+		if(refimg->x == imgx && refimg->y == imgy) {
+			if(ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
+				refimg= typecheck_compbuf(in[1]->data, CB_RGBA);
+				found_determinator= 1;
+			}
+		}
+	}
+	else {
+		refimg= img;
+	}
+
+	/* allocs */
+	source= dupalloc_compbuf(img);
+	new= alloc_compbuf(imgx, imgy, pix, 1);
+	
+	/* accept image offsets from other nodes */
+	new->xof= img->xof;
+	new->yof= img->yof;
+
+	/* bilateral code properties */
+	sigma_color= nbbd->sigma_color;
+	sigma_space= nbbd->sigma_space;
+	
+	i2sigma_color= 1. / (sigma_color * sigma_color);
+	i2sigma_space= 1. / (sigma_space * sigma_space);
+
+	INIT_3X3_DELTAS(deltas, step, pix);
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list