[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39209] branches/soc-2011-tomato/source/ blender/blenkernel/intern/movieclip.c: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Tue Aug 9 15:05:19 CEST 2011


Revision: 39209
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39209
Author:   nazgul
Date:     2011-08-09 13:05:18 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================

Fixed tracking speed regression caused by proxies commit.
Use frames from cache when tracking if available and also
but frames read during tracking into cache (if proxying
allows this).

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2011-08-09 12:08:46 UTC (rev 39208)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2011-08-09 13:05:18 UTC (rev 39209)
@@ -483,17 +483,30 @@
 	ImBuf *ibuf= NULL;
 	int framenr= user?user->framenr:clip->lastframe;
 
-	if(clip->source==MCLIP_SRC_SEQUENCE) {
-		ibuf= movieclip_load_sequence_file(clip, framenr, flag);
-	} else {
-		/* loading of movies can't happen from concurent threads */
-		BLI_lock_thread(LOCK_MOVIECLIP);
+	/* cache isn't threadsafe itself and also loading of movies
+	   can't happen from concurent threads that's why we use lock here */
+	BLI_lock_thread(LOCK_MOVIECLIP);
 
-		ibuf= movieclip_load_movie_file(clip, framenr, flag);
+	/* cache is supposed to be threadsafe */
+	ibuf= get_imbuf_cache(clip, user, flag);
 
-		BLI_unlock_thread(LOCK_MOVIECLIP);
+	if(!ibuf) {
+		if(clip->source==MCLIP_SRC_SEQUENCE) {
+			ibuf= movieclip_load_sequence_file(clip, framenr, flag);
+		} else {
+			ibuf= movieclip_load_movie_file(clip, framenr, flag);
+		}
+
+		if(ibuf) {
+			int bits= MCLIP_USE_PROXY|MCLIP_USE_PROXY_CUSTOM_DIR;
+
+			if((flag&bits)==(clip->flag&bits))
+				put_imbuf_cache(clip, user, ibuf, clip->flag);
+		}
 	}
 
+	BLI_unlock_thread(LOCK_MOVIECLIP);
+
 	return ibuf;
 }
 




More information about the Bf-blender-cvs mailing list