[Bf-blender-cvs] [4bbe0c8] master: Fix T41785: The combination of movie-distortion and lens-distortion leads to artifacts

Sergey Sharybin noreply at git.blender.org
Thu Sep 11 15:07:29 CEST 2014


Commit: 4bbe0c8cded98d4daafe1707766041ca9b86db36
Author: Sergey Sharybin
Date:   Thu Sep 11 19:07:03 2014 +0600
Branches: master
https://developer.blender.org/rB4bbe0c8cded98d4daafe1707766041ca9b86db36

Fix T41785: The combination of movie-distortion and lens-distortion leads to artifacts

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

M	source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
M	source/blender/compositor/operations/COM_MovieDistortionOperation.h

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

diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index 28b1fc1..eb8e5a8 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -68,13 +68,10 @@ void MovieDistortionOperation::initExecution()
 			{
 				this->m_cache = c;
 				this->m_cache->updateLastUsage();
+				this->m_cache->getMargin(this->m_margin);
 				return;
 			}
 		}
-		DistortionCache *newC = new DistortionCache(this->m_movieClip, this->m_width, this->m_height,
-		                                            calibration_width, calibration_height, this->m_distortion);
-		s_cache.push_back(newC);
-		this->m_cache = newC;
 
 		if (this->m_distortion) {
 			float delta[2];
@@ -96,6 +93,14 @@ void MovieDistortionOperation::initExecution()
 			 */
 			m_margin[0] = m_margin[1] = 0;
 		}
+
+		DistortionCache *newC = new DistortionCache(this->m_movieClip,
+		                                            this->m_width, this->m_height,
+		                                            calibration_width, calibration_height,
+		                                            this->m_distortion,
+		                                            this->m_margin);
+		s_cache.push_back(newC);
+		this->m_cache = newC;
 	}
 	else {
 		this->m_cache = NULL;
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index a1dd08d..9e8d7ee 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -50,9 +50,14 @@ private:
 	float *m_buffer;
 	int *m_bufferCalculated;
 	double timeLastUsage;
+	int m_margin[2];
 	
 public:
-	DistortionCache(MovieClip *movieclip, int width, int height, int calibration_width, int calibration_height, bool inverted) {
+	DistortionCache(MovieClip *movieclip,
+	                int width, int height,
+	                int calibration_width, int calibration_height,
+	                bool inverted,
+	                const int margin[2]) {
 		this->m_k1 = movieclip->tracking.camera.k1;
 		this->m_k2 = movieclip->tracking.camera.k2;
 		this->m_k3 = movieclip->tracking.camera.k3;
@@ -66,6 +71,7 @@ public:
 		this->m_inverted = inverted;
 		this->m_bufferCalculated = (int *)MEM_callocN(sizeof(int) * this->m_width * this->m_height, __func__);
 		this->m_buffer = (float *)MEM_mallocN(sizeof(float) * this->m_width * this->m_height * 2, __func__);
+		copy_v2_v2_int(this->m_margin, margin);
 		this->updateLastUsage();
 	}
 	
@@ -89,7 +95,10 @@ public:
 		return this->timeLastUsage;
 	}
 
-	bool isCacheFor(MovieClip *movieclip, int width, int height, int calibration_width, int claibration_height, bool inverted) {
+	bool isCacheFor(MovieClip *movieclip,
+	                int width, int height,
+	                int calibration_width, int claibration_height,
+	                bool inverted) {
 		return this->m_k1 == movieclip->tracking.camera.k1 &&
 		       this->m_k2 == movieclip->tracking.camera.k2 &&
 		       this->m_k3 == movieclip->tracking.camera.k3 &&
@@ -141,6 +150,11 @@ public:
 			*v = this->m_buffer[offset2 + 1];
 		}
 	}
+
+	void getMargin(int margin[2])
+	{
+		copy_v2_v2_int(margin, m_margin);
+	}
 };
 
 class MovieDistortionOperation : public NodeOperation {




More information about the Bf-blender-cvs mailing list