[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50052] branches/soc-2011-tomato/source/ blender: Sequencer: clear cache and animation buffers for strips outside of cursor when rendering

Sergey Sharybin sergey.vfx at gmail.com
Mon Aug 20 18:15:09 CEST 2012


Revision: 50052
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50052
Author:   nazgul
Date:     2012-08-20 16:15:09 +0000 (Mon, 20 Aug 2012)
Log Message:
-----------
Sequencer: clear cache and animation buffers for strips outside of cursor when rendering

This avoids having bunch of cached images when doing animation rendering,
keeping all the memory available for rendered itself.

This keeps memory usage low when rendering huge edits with mixed
scenes and movie strips.

This should not affect on sped of video encoding, which was confirmed by
some own tests.

Currently commiting to tomato due to not sure if there's something
i can not foresee here.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_sequencer.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_sequencer.c
    branches/soc-2011-tomato/source/blender/render/intern/source/pipeline.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_sequencer.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_sequencer.h	2012-08-20 16:09:53 UTC (rev 50051)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_sequencer.h	2012-08-20 16:15:09 UTC (rev 50052)
@@ -290,7 +290,7 @@
 int BKE_sequence_base_shuffle(struct ListBase *seqbasep, struct Sequence *test, struct Scene *evil_scene);
 int BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene);
 int BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase);
-void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, int check_mem_usage, int keep_file_handles);
+void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, int for_render);
 struct Sequence *BKE_sequence_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence *seq, int dupe_flag);
 int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
 

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c	2012-08-20 16:09:53 UTC (rev 50051)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c	2012-08-20 16:15:09 UTC (rev 50052)
@@ -2991,46 +2991,27 @@
 	sequence_invalidate_cache(scene, seq, FALSE);
 }
 
-void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
+void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int for_render)
 {
 	Sequence *seq;
 
-	if (check_mem_usage) {
-		/* Let the cache limitor take care of this (schlaile) */
-		/* While render let's keep all memory available for render 
-		 * (ton)
-		 * At least if free memory is tight...
-		 * This can make a big difference in encoding speed
-		 * (it is around 4 times(!) faster, if we do not waste time
-		 * on freeing _all_ buffers every time on long timelines...)
-		 * (schlaile)
-		 */
-	
-		uintptr_t mem_in_use;
-		uintptr_t mmap_in_use;
-		uintptr_t max;
-	
-		mem_in_use = MEM_get_memory_in_use();
-		mmap_in_use = MEM_get_mapped_memory_in_use();
-		max = MEM_CacheLimiter_get_maximum();
-	
-		if (max == 0 || mem_in_use + mmap_in_use <= max) {
-			return;
-		}
-	}
-
 	BKE_sequencer_cache_cleanup();
-	
+
 	for (seq = seqbase->first; seq; seq = seq->next) {
+		if (for_render && CFRA >= seq->startdisp && CFRA <= seq->enddisp) {
+			continue;
+		}
+
 		if (seq->strip) {
-			if (seq->type == SEQ_TYPE_MOVIE && !keep_file_handles)
+			if (seq->type == SEQ_TYPE_MOVIE) {
 				free_anim_seq(seq);
+			}
 			if (seq->type == SEQ_TYPE_SPEED) {
 				BKE_sequence_effect_speed_rebuild_map(scene, seq, 1);
 			}
 		}
 		if (seq->type == SEQ_TYPE_META) {
-			BKE_sequencer_free_imbuf(scene, &seq->seqbase, FALSE, keep_file_handles);
+			BKE_sequencer_free_imbuf(scene, &seq->seqbase, for_render);
 		}
 		if (seq->type == SEQ_TYPE_SCENE) {
 			/* FIXME: recurs downwards, 

Modified: branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c	2012-08-20 16:09:53 UTC (rev 50051)
+++ branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c	2012-08-20 16:15:09 UTC (rev 50052)
@@ -170,7 +170,7 @@
 		BKE_sequencer_proxy_rebuild_finish(link->data, pj->stop);
 	}
 
-	BKE_sequencer_free_imbuf(pj->scene, &ed->seqbase, FALSE, FALSE);
+	BKE_sequencer_free_imbuf(pj->scene, &ed->seqbase, FALSE);
 
 	WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
 }
@@ -1340,7 +1340,7 @@
 	Scene *scene = CTX_data_scene(C);
 	Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
 
-	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
+	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
 
 	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
@@ -2880,7 +2880,7 @@
 	BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1);
 
 	/* important else we don't get the imbuf cache flushed */
-	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
+	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
 
 	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
@@ -2940,7 +2940,7 @@
 	BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1);
 
 	/* important else we don't get the imbuf cache flushed */
-	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
+	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
 
 	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
@@ -3013,7 +3013,7 @@
 		BKE_sequence_calc(scene, seq);
 
 		/* important else we don't get the imbuf cache flushed */
-		BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
+		BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
 	}
 	else {
 		/* lame, set rna filepath */

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_sequencer.c	2012-08-20 16:09:53 UTC (rev 50051)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_sequencer.c	2012-08-20 16:15:09 UTC (rev 50052)
@@ -659,7 +659,7 @@
 	Scene *scene = (Scene *) ptr->id.data;
 	Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
 
-	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
+	BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
 
 	if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
 		BKE_sequencer_update_sound_bounds(scene, ptr->data);

Modified: branches/soc-2011-tomato/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/soc-2011-tomato/source/blender/render/intern/source/pipeline.c	2012-08-20 16:09:53 UTC (rev 50051)
+++ branches/soc-2011-tomato/source/blender/render/intern/source/pipeline.c	2012-08-20 16:15:09 UTC (rev 50052)
@@ -1689,7 +1689,7 @@
 		if (recurs_depth == 0) { /* with nested scenes, only free on toplevel... */
 			Editing *ed = re->scene->ed;
 			if (ed)
-				BKE_sequencer_free_imbuf(re->scene, &ed->seqbase, TRUE, TRUE);
+				BKE_sequencer_free_imbuf(re->scene, &ed->seqbase, TRUE);
 		}
 		IMB_freeImBuf(ibuf);
 	}




More information about the Bf-blender-cvs mailing list