[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48495] trunk/blender/source/blender/ compositor: Limit out of screen tiles to be scheduled.

Jeroen Bakker j.bakker at atmind.nl
Mon Jul 2 17:26:57 CEST 2012


Revision: 48495
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48495
Author:   jbakker
Date:     2012-07-02 15:26:47 +0000 (Mon, 02 Jul 2012)
Log Message:
-----------
Limit out of screen tiles to be scheduled.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
    trunk/blender/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp

Modified: trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp	2012-07-02 15:25:56 UTC (rev 48494)
+++ trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp	2012-07-02 15:26:47 UTC (rev 48495)
@@ -485,14 +485,18 @@
 	float chunkSizef = this->m_chunkSize;
 
 	int indexx, indexy;
-	const int minxchunk = floor(area->xmin / chunkSizef);
-	const int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
-	const int minychunk = floor(area->ymin / chunkSizef);
-	const int maxychunk = ceil((area->ymax - 1) / chunkSizef);
+	int minxchunk = floor(area->xmin / chunkSizef);
+	int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
+	int minychunk = floor(area->ymin / chunkSizef);
+	int maxychunk = ceil((area->ymax - 1) / chunkSizef);
+	minxchunk = MAX2(minxchunk, 0);
+	minychunk = MAX2(minychunk, 0);
+	maxxchunk = MIN2(maxxchunk, this->m_numberOfXChunks);
+	maxychunk = MIN2(maxychunk, this->m_numberOfYChunks);
 
 	bool result = true;
-	for (indexx = max(minxchunk, 0); indexx < maxxchunk; indexx++) {
-		for (indexy = max(minychunk, 0); indexy < maxychunk; indexy++) {
+	for (indexx = minxchunk; indexx < maxxchunk; indexx++) {
+		for (indexy = minychunk; indexy < maxychunk; indexy++) {
 			if (!scheduleChunkWhenPossible(graph, indexx, indexy)) {
 				result = false;
 			}

Modified: trunk/blender/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp	2012-07-02 15:25:56 UTC (rev 48494)
+++ trunk/blender/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp	2012-07-02 15:26:47 UTC (rev 48495)
@@ -36,6 +36,7 @@
 }
 void ProjectorLensDistortionOperation::initExecution()
 {
+	this->initMutex();
 	this->m_inputProgram = this->getInputSocketReader(0);
 }
 
@@ -65,6 +66,7 @@
 
 void ProjectorLensDistortionOperation::deinitExecution()
 {
+	this->deinitMutex();
 	this->m_inputProgram = NULL;
 }
 
@@ -77,16 +79,18 @@
 		newInput.xmin = input->xmin - this->m_kr2 - 2;
 		newInput.xmax = input->xmax + this->m_kr2 + 2;
 	} else {
-		newInput.xmin = 0;
+		newInput.xmin = input->xmin-7; //(0.25f*20*1)+2 == worse case dispersion
 		newInput.ymin = input->ymin;
 		newInput.ymax = input->ymax;
-		newInput.xmax = this->m_inputProgram->getWidth();
+		newInput.xmax = input->xmax+7; //(0.25f*20*1)+2 == worse case dispersion
 	}
 	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
 void ProjectorLensDistortionOperation::updateDispersion(MemoryBuffer **inputBuffers) 
 {
+	if (this->m_dispersionAvailable) return;
+	this->lockMutex();
 	if (!this->m_dispersionAvailable) {
 		float result[4];
 		this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers);
@@ -95,4 +99,5 @@
 		this->m_kr2 = this->m_kr * 20;
 		this->m_dispersionAvailable = true;
 	}
+	this->unlockMutex();
 }




More information about the Bf-blender-cvs mailing list