[Bf-blender-cvs] [2ae0f1e] master: Fix T43908: Mask render bug, one pixel black line

Sergey Sharybin noreply at git.blender.org
Mon Mar 9 08:48:50 CET 2015


Commit: 2ae0f1e70be543b37f426dc1b7d8a44b05301faf
Author: Sergey Sharybin
Date:   Mon Mar 9 12:45:01 2015 +0500
Branches: master
https://developer.blender.org/rB2ae0f1e70be543b37f426dc1b7d8a44b05301faf

Fix T43908: Mask render bug, one pixel black line

This was a regression caused by attempts to fix T42844 and there were
some red-herrings which lead me to the wrong way to fix it. It's some
deeper issue than just interpolation offset, it's mainly how the node
resolution is being mapped to each other.

It could be actually a part of canvas awareness project..

===================================================================

M	source/blender/compositor/intern/COM_MemoryBuffer.h
M	source/blender/compositor/operations/COM_CompositorOperation.cpp
M	source/blender/compositor/operations/COM_ImageOperation.cpp
M	source/blender/compositor/operations/COM_MovieClipOperation.cpp
M	source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
M	source/blender/compositor/operations/COM_RenderLayersProg.cpp
M	source/blender/compositor/operations/COM_ViewerOperation.cpp
M	source/blender/compositor/operations/COM_WriteBufferOperation.cpp

===================================================================

diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index e0c5421..322e4bc 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -259,7 +259,7 @@ public:
 		float u = x;
 		float v = y;
 		this->wrap_pixel(u, v, extend_x, extend_y);
-		BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u - 0.5f, v - 0.5f);
+		BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u, v);
 	}
 
 	void readEWA(float *result, const float uv[2], const float derivatives[2][2], PixelSampler sampler);
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index c2c6a12..e3438bc 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -185,7 +185,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 
 	for (y = y1; y < y2 && (!breaked); y++) {
 		for (x = x1; x < x2 && (!breaked); x++) {
-			float input_x = (float)x + dx + 0.5f, input_y = (float)y + dy + 0.5f;
+			int input_x = x + dx, input_y = y + dy;
 
 			this->m_imageInput->readSampled(color, input_x, input_y, COM_PS_NEAREST);
 			if (this->m_useAlphaInput) {
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index ff0ffe2..2733c48 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -119,10 +119,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa
 				nearest_interpolation_color(ibuf, NULL, color, x, y);
 				break;
 			case COM_PS_BILINEAR:
-				bilinear_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f);
+				bilinear_interpolation_color(ibuf, NULL, color, x, y);
 				break;
 			case COM_PS_BICUBIC:
-				bicubic_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f);
+				bicubic_interpolation_color(ibuf, NULL, color, x, y);
 				break;
 		}
 	}
@@ -133,10 +133,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa
 				nearest_interpolation_color(ibuf, byte_color, NULL, x, y);
 				break;
 			case COM_PS_BILINEAR:
-				bilinear_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f);
+				bilinear_interpolation_color(ibuf, byte_color, NULL, x, y);
 				break;
 			case COM_PS_BICUBIC:
-				bicubic_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f);
+				bicubic_interpolation_color(ibuf, byte_color, NULL, x, y);
 				break;
 		}
 		rgba_uchar_to_float(color, byte_color);
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index 2ed498d..9a184ae 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -103,10 +103,10 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], float x, float
 				nearest_interpolation_color(ibuf, NULL, output, x, y);
 				break;
 			case COM_PS_BILINEAR:
-				bilinear_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f);
+				bilinear_interpolation_color(ibuf, NULL, output, x, y);
 				break;
 			case COM_PS_BICUBIC:
-				bicubic_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f);
+				bicubic_interpolation_color(ibuf, NULL, output, x, y);
 				break;
 		}
 	}
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
index 35ab20f..23fba5a 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
@@ -54,10 +54,10 @@ void MultilayerColorOperation::executePixelSampled(float output[4], float x, flo
 					nearest_interpolation_color(this->m_buffer, NULL, output, x, y);
 					break;
 				case COM_PS_BILINEAR:
-					bilinear_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f);
+					bilinear_interpolation_color(this->m_buffer, NULL, output, x, y);
 					break;
 				case COM_PS_BICUBIC:
-					bicubic_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f);
+					bicubic_interpolation_color(this->m_buffer, NULL, output, x, y);
 					break;
 			}
 		}
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index 121998b..409fa68 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -104,11 +104,11 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi
 		}
 
 		case COM_PS_BILINEAR:
-			BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f);
+			BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
 			break;
 
 		case COM_PS_BICUBIC:
-			BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f);
+			BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
 			break;
 	}
 }
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index defad16..53c0acd 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -100,12 +100,12 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 
 	for (y = y1; y < y2 && (!breaked); y++) {
 		for (x = x1; x < x2; x++) {
-			this->m_imageInput->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
+			this->m_imageInput->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST);
 			if (this->m_useAlphaInput) {
-				this->m_alphaInput->readSampled(alpha, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
+				this->m_alphaInput->readSampled(alpha, x, y, COM_PS_NEAREST);
 				buffer[offset4 + 3] = alpha[0];
 			}
-			this->m_depthInput->readSampled(depth, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
+			this->m_depthInput->readSampled(depth, x, y, COM_PS_NEAREST);
 			depthbuffer[offset] = depth[0];
 
 			offset ++;
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index 58bded7..fccff2a 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -74,7 +74,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 		for (y = y1; y < y2 && (!breaked); y++) {
 			int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels;
 			for (x = x1; x < x2; x++) {
-				this->m_input->read(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, data);
+				this->m_input->read(&(buffer[offset4]), x, y, data);
 				offset4 += num_channels;
 			}
 			if (isBreaked()) {
@@ -99,7 +99,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 		for (y = y1; y < y2 && (!breaked); y++) {
 			int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels;
 			for (x = x1; x < x2; x++) {
-				this->m_input->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
+				this->m_input->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST);
 				offset4 += num_channels;
 			}
 			if (isBreaked()) {




More information about the Bf-blender-cvs mailing list