[Bf-blender-cvs] [5a29b55] master: Fix T39206: Plane deform works incredibly slow

Sergey Sharybin noreply at git.blender.org
Fri Apr 11 10:51:27 CEST 2014


Commit: 5a29b55c07e34411747c091195a1a1e5fcb1ef7d
Author: Sergey Sharybin
Date:   Fri Apr 11 14:48:54 2014 +0600
https://developer.blender.org/rB5a29b55c07e34411747c091195a1a1e5fcb1ef7d

Fix T39206: Plane deform works incredibly slow

The issue was caused by the readEWA spending loads of time trying
to sample regions outside of the buffer.Solved by adding an early
exit check.

We could also clamp the sampling region to the rect, but it's
not so much clear whether weight will be correct in such case
so left it for the future.

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

M	source/blender/compositor/intern/COM_MemoryBuffer.cpp

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

diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 65cd74a..7499173 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -288,6 +288,15 @@ void MemoryBuffer::readEWA(float result[4], const float uv[2], const float deriv
 	if (V0 - v1 > EWA_MAXIDX) v1 = V0 - EWA_MAXIDX;
 	if (v2 - V0 > EWA_MAXIDX) v2 = V0 + EWA_MAXIDX;
 
+	/* Early output check for cases the whole region is outside of the buffer. */
+	if ((u2 < m_rect.xmin || u1 >= m_rect.xmax) ||
+	    (v2 < m_rect.ymin || v1 >= m_rect.ymax))
+	{
+		zero_v4(result);
+		return;
+	}
+	/* TODO(sergey): Consider clamping u1/v1/u2/v2 to the m_rect. */
+
 	float DDQ = 2.0f * A;
 	float U = u1 - U0;
 	float ac1 = A * (2.0f * U + 1.0f);




More information about the Bf-blender-cvs mailing list