Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-04-11 12:48:54 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-04-11 12:51:21 +0400
commit5a29b55c07e34411747c091195a1a1e5fcb1ef7d (patch)
tree75edef61032344c06eb9492af34bf48e5a62dfff /source/blender/compositor/intern/COM_MemoryBuffer.cpp
parentc04e73f38638e37b07b5ce6e0483cb96b7143580 (diff)
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.
Diffstat (limited to 'source/blender/compositor/intern/COM_MemoryBuffer.cpp')
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 65cd74a971f..74991738d7a 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);