[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49842] branches/soc-2011-tomato/source/ blender/compositor/operations/COM_InpaintOperation.cpp: == Inpaint Node ==

Peter Schlaile peter at schlaile.de
Sun Aug 12 17:59:41 CEST 2012


Revision: 49842
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49842
Author:   schlaile
Date:     2012-08-12 15:59:40 +0000 (Sun, 12 Aug 2012)
Log Message:
-----------
== Inpaint Node ==

Fixed several small (stupid) issues with the inpaint node:

* on pixel order building, some ranges got wrong and origin was considered
  several times.

* the convolution kernel didn't consider all pixels (+1,0),(-1,0),(0,1) and (0-1)
  were omited, leading to suboptimal results (sometimes even black areas)

* alpha channel is now only affected an areas considered by inpaint.
  That's only important, if you choose low iteration counts.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp	2012-08-12 14:57:19 UTC (rev 49841)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp	2012-08-12 15:59:40 UTC (rev 49842)
@@ -142,7 +142,7 @@
 	}
 	
 	for (int j = height - 1; j >= 0; j--) {
-		for (int i = width; i >= 0; i--) {
+		for (int i = width - 1; i >= 0; i--) {
 			int r = m[j * width + i];
 			
 			if (i + 1 < width) 
@@ -184,8 +184,7 @@
 
 	for (int dx = -1; dx <= 1; dx++) {
 		for (int dy = -1; dy <= 1; dy++) {
-			if (dx != 0 && dy != 0) {
-
+			if (dx != 0 || dy != 0) {
 				int x_ofs = x + dx;
 				int y_ofs = y + dy;
 
@@ -210,6 +209,8 @@
 	}
 
 	mul_v3_v3fl(this->get_pixel(x, y), pix, 1.0f / n);
+
+	this->get_pixel(x, y)[3] = 1.0f;
 }
 
 void *InpaintSimpleOperation::initializeTileData(rcti *rect)
@@ -243,8 +244,7 @@
 void InpaintSimpleOperation::executePixel(float output[4], int x, int y, void *data)
 {
 	this->clamp_xy(x, y);
-	copy_v3_v3(output, this->get_pixel(x, y));
-	output[3] = 1.0f;
+	copy_v4_v4(output, this->get_pixel(x, y));
 }
 
 void InpaintSimpleOperation::deinitExecution()




More information about the Bf-blender-cvs mailing list