[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58873] branches/soc-2011-tomato/source/ blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp: Use a proper depending are of interest for image warping
Sergey Sharybin
sergey.vfx at gmail.com
Sat Aug 3 21:53:30 CEST 2013
Revision: 58873
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58873
Author: nazgul
Date: 2013-08-03 19:53:30 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
Use a proper depending are of interest for image warping
Instead of requesting the whole frame to be evaluated
before plane warping could be invoked, warp tile into
original image space and use it's bounding box as area
of interest.
There're some tricks with margins going on still, but
without them some tiles are missing.
Quick tests seems to be working fine, we could solve
possible remaining issue later.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp 2013-08-03 19:53:24 UTC (rev 58872)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp 2013-08-03 19:53:30 UTC (rev 58873)
@@ -149,13 +149,33 @@
bool PlaneTrackWarpImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
+ float frame_space_corners[4][2];
+
+ for (int i = 0; i < 4; i++) {
+ frame_space_corners[i][0] = this->m_corners[i][0] * this->getWidth();
+ frame_space_corners[i][1] = this->m_corners[i][1] * this->getHeight();
+ }
+
+ float UVs[4][2];
+
+ /* TODO(sergey): figure out proper way to do this. */
+ resolveUV(input->xmin - 2, input->ymin - 2, frame_space_corners, UVs[0]);
+ resolveUV(input->xmax + 2, input->ymin - 2, frame_space_corners, UVs[1]);
+ resolveUV(input->xmax + 2, input->ymax + 2, frame_space_corners, UVs[2]);
+ resolveUV(input->xmin - 2, input->ymax + 2, frame_space_corners, UVs[3]);
+
+ float min[2], max[2];
+ INIT_MINMAX2(min, max);
+ for (int i = 0; i < 4; i++) {
+ minmax_v2v2_v2(min, max, UVs[i]);
+ }
+
rcti newInput;
- /* XXX: use real area of interest! */
- newInput.xmin = 0;
- newInput.ymin = 0;
- newInput.xmax = readOperation->getWidth();
- newInput.ymax = readOperation->getHeight();
+ newInput.xmin = min[0] * readOperation->getWidth() - 1;
+ newInput.ymin = min[1] * readOperation->getHeight() - 1;
+ newInput.xmax = max[0] * readOperation->getWidth() + 1;
+ newInput.ymax = max[1] * readOperation->getHeight() + 1;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
More information about the Bf-blender-cvs
mailing list