[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45923] branches/tile/source/blender/ compositor: TileBranch

Jeroen Bakker j.bakker at atmind.nl
Tue Apr 24 15:39:14 CEST 2012


Revision: 45923
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45923
Author:   jbakker
Date:     2012-04-24 13:39:14 +0000 (Tue, 24 Apr 2012)
Log Message:
-----------
TileBranch
 * Fixed Convolution filters

Modified Paths:
--------------
    branches/tile/source/blender/compositor/nodes/COM_FilterNode.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
    branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h

Modified: branches/tile/source/blender/compositor/nodes/COM_FilterNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_FilterNode.cpp	2012-04-24 12:57:58 UTC (rev 45922)
+++ branches/tile/source/blender/compositor/nodes/COM_FilterNode.cpp	2012-04-24 13:39:14 UTC (rev 45923)
@@ -72,9 +72,9 @@
 		break;
 	}
 	
-	inputImageSocket->relinkConnections(operation->getInputSocket(0), true, 0, graph);
+	inputImageSocket->relinkConnections(operation->getInputSocket(0), true, 1, graph);
 	inputSocket->relinkConnections(operation->getInputSocket(1), true, 0, graph);
-	outputSocket->relinkConnections(operation->getOutputSocket(0));
+	outputSocket->relinkConnections(operation->getOutputSocket());
 	addPreviewOperation(graph, operation->getOutputSocket(0), 5);
 	
 	graph->addOperation(operation);

Modified: branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp	2012-04-24 12:57:58 UTC (rev 45922)
+++ branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp	2012-04-24 13:39:14 UTC (rev 45923)
@@ -26,70 +26,70 @@
 ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation() {
 }
 inline void addFilter(float* result, float*input, float value) {
-    result[0] += input[0] * value;
-    result[1] += input[1] * value;
-    result[2] += input[2] * value;
+	result[0] += input[0] * value;
+	result[1] += input[1] * value;
+	result[2] += input[2] * value;
 }
 
-void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
-    float in1[4],in2[4], res1[4], res2[4];
-
-    float value[4];
-    this->inputValueOperation->read(value, x, y, sampler, inputBuffers);
-    float mval = 1.0f - value[0];
-
-    res1[0] = 0.0f;
-    res1[1] = 0.0f;
-    res1[2] = 0.0f;
-    res1[3] = 0.0f;
-    res2[0] = 0.0f;
-    res2[1] = 0.0f;
-    res2[2] = 0.0f;
-    res2[3] = 0.0f;
-
-    this->inputOperation->read(in1, x-1, y-1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[0]);
-    addFilter(res2, in1, this->filter[0]);
-
-    this->inputOperation->read(in1, x, y-1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[1]);
-    addFilter(res2, in1, this->filter[3]);
-
-    this->inputOperation->read(in1, x+1, y-1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[2]);
-    addFilter(res2, in1, this->filter[6]);
-
-    this->inputOperation->read(in1, x-1, y, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[3]);
-    addFilter(res2, in1, this->filter[1]);
-
-    this->inputOperation->read(in2, x, y, inputBuffers, NULL);
-    addFilter(res1, in2, this->filter[4]);
-    addFilter(res2, in2, this->filter[4]);
-
-    this->inputOperation->read(in1, x+1, y, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[5]);
-    addFilter(res2, in1, this->filter[7]);
-
-    this->inputOperation->read(in1, x-1, y+1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[6]);
-    addFilter(res2, in1, this->filter[2]);
-
-    this->inputOperation->read(in1, x, y+1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[7]);
-    addFilter(res2, in1, this->filter[5]);
-
-    this->inputOperation->read(in1, x+1, y+1, inputBuffers, NULL);
-    addFilter(res1, in1, this->filter[8]);
-    addFilter(res2, in1, this->filter[8]);
-
-    color[0] = sqrt(res1[0]*res1[0]+res2[0]*res2[0]);
-    color[1] = sqrt(res1[1]*res1[1]+res2[1]*res2[1]);
-    color[2] = sqrt(res1[2]*res1[2]+res2[2]*res2[2]);
-
-    color[0] = color[0]*value[0] + in2[0] * mval;
-    color[1] = color[1]*value[0] + in2[1] * mval;
-    color[2] = color[2]*value[0] + in2[2] * mval;
-
-    color[3] = in2[3];
+void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) {
+	float in1[4],in2[4], res1[4], res2[4];
+	
+	float value[4];
+	this->inputValueOperation->read(value, x, y, inputBuffers, NULL);
+	float mval = 1.0f - value[0];
+	
+	res1[0] = 0.0f;
+	res1[1] = 0.0f;
+	res1[2] = 0.0f;
+	res1[3] = 0.0f;
+	res2[0] = 0.0f;
+	res2[1] = 0.0f;
+	res2[2] = 0.0f;
+	res2[3] = 0.0f;
+	
+	this->inputOperation->read(in1, x-1, y-1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[0]);
+	addFilter(res2, in1, this->filter[0]);
+	
+	this->inputOperation->read(in1, x, y-1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[1]);
+	addFilter(res2, in1, this->filter[3]);
+	
+	this->inputOperation->read(in1, x+1, y-1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[2]);
+	addFilter(res2, in1, this->filter[6]);
+	
+	this->inputOperation->read(in1, x-1, y, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[3]);
+	addFilter(res2, in1, this->filter[1]);
+	
+	this->inputOperation->read(in2, x, y, inputBuffers, NULL);
+	addFilter(res1, in2, this->filter[4]);
+	addFilter(res2, in2, this->filter[4]);
+	
+	this->inputOperation->read(in1, x+1, y, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[5]);
+	addFilter(res2, in1, this->filter[7]);
+	
+	this->inputOperation->read(in1, x-1, y+1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[6]);
+	addFilter(res2, in1, this->filter[2]);
+	
+	this->inputOperation->read(in1, x, y+1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[7]);
+	addFilter(res2, in1, this->filter[5]);
+	
+	this->inputOperation->read(in1, x+1, y+1, inputBuffers, NULL);
+	addFilter(res1, in1, this->filter[8]);
+	addFilter(res2, in1, this->filter[8]);
+	
+	color[0] = sqrt(res1[0]*res1[0]+res2[0]*res2[0]);
+	color[1] = sqrt(res1[1]*res1[1]+res2[1]*res2[1]);
+	color[2] = sqrt(res1[2]*res1[2]+res2[2]*res2[2]);
+	
+	color[0] = color[0]*value[0] + in2[0] * mval;
+	color[1] = color[1]*value[0] + in2[1] * mval;
+	color[2] = color[2]*value[0] + in2[2] * mval;
+	
+	color[3] = in2[3];
 }

Modified: branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h	2012-04-24 12:57:58 UTC (rev 45922)
+++ branches/tile/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h	2012-04-24 13:39:14 UTC (rev 45923)
@@ -27,8 +27,8 @@
 
 class ConvolutionEdgeFilterOperation: public ConvolutionFilterOperation {
 public:
-    ConvolutionEdgeFilterOperation();
-    void executePixel(float *color, int x, int y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+	ConvolutionEdgeFilterOperation();
+	void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data);
 };
 
 #endif

Modified: branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp	2012-04-24 12:57:58 UTC (rev 45922)
+++ branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp	2012-04-24 13:39:14 UTC (rev 45923)
@@ -23,13 +23,13 @@
 #include "COM_ConvolutionFilterOperation.h"
 
 ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() {
-    this->addInputSocket(COM_DT_COLOR);
-    this->addInputSocket(COM_DT_VALUE);
-    this->addOutputSocket(COM_DT_COLOR);
-    this->setResolutionInputSocketIndex(0);
-    this->inputOperation = NULL;
-    this->filter = NULL;
-    this->setComplex(true);
+	this->addInputSocket(COM_DT_COLOR);
+	this->addInputSocket(COM_DT_VALUE);
+	this->addOutputSocket(COM_DT_COLOR);
+	this->setResolutionInputSocketIndex(0);
+	this->inputOperation = NULL;
+	this->filter = NULL;
+	this->setComplex(true);
 }
 void ConvolutionFilterOperation::initExecution() {
 	this->inputOperation = this->getInputSocketReader(0);
@@ -37,100 +37,100 @@
 }
 
 void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
-    this->filter = new float[9];
-    this->filter[0] = f1;
-    this->filter[1] = f2;
-    this->filter[2] = f3;
-    this->filter[3] = f4;
-    this->filter[4] = f5;
-    this->filter[5] = f6;
-    this->filter[6] = f7;
-    this->filter[7] = f8;
-    this->filter[8] = f9;
-    this->filterHeight = 3;
-    this->filterWidth = 3;
+	this->filter = new float[9];
+	this->filter[0] = f1;
+	this->filter[1] = f2;
+	this->filter[2] = f3;
+	this->filter[3] = f4;
+	this->filter[4] = f5;
+	this->filter[5] = f6;
+	this->filter[6] = f7;
+	this->filter[7] = f8;
+	this->filter[8] = f9;
+	this->filterHeight = 3;
+	this->filterWidth = 3;
 }
 
 void ConvolutionFilterOperation::deinitExecution() {
-    this->inputOperation = NULL;
-    this->inputValueOperation = NULL;
-    if (this->filter) {
-        delete this->filter;
-        this->filter = NULL;
-    }
+	this->inputOperation = NULL;
+	this->inputValueOperation = NULL;
+	if (this->filter) {
+		delete this->filter;
+		this->filter = NULL;
+	}
 }
 
 
-void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[]) {
-    color[0] = 0.0;
-    color[1] = 0.0;
-    color[2] = 0.0;
-    color[3] = 0.0;
-    float in1[4];
-    float in2[4];
-    float value[4];
+void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) {
+	color[0] = 0.0;
+	color[1] = 0.0;
+	color[2] = 0.0;
+	color[3] = 0.0;
+	float in1[4];
+	float in2[4];
+	float value[4];
 	this->inputValueOperation->read(value, x, y, inputBuffers, NULL);
-    float mval = 1.0f - value[0];
-
+	float mval = 1.0f - value[0];
+	
 	this->inputOperation->read(in1, x-1, y-1, inputBuffers, NULL);
-    color[0] += in1[0] * this->filter[0];
-    color[1] += in1[1] * this->filter[0];
-    color[2] += in1[2] * this->filter[0];
-    color[3] += in1[3] * this->filter[0];
+	color[0] += in1[0] * this->filter[0];
+	color[1] += in1[1] * this->filter[0];
+	color[2] += in1[2] * this->filter[0];
+	color[3] += in1[3] * this->filter[0];
 	this->inputOperation->read(in1, x, y-1, inputBuffers, NULL);
-    color[0] += in1[0] * this->filter[1];
-    color[1] += in1[1] * this->filter[1];
-    color[2] += in1[2] * this->filter[1];
-    color[3] += in1[3] * this->filter[1];
+	color[0] += in1[0] * this->filter[1];

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list