[Bf-blender-cvs] [ebb81050c58] studio-sprite-fright: VSE: Free animation strip data if they are not visible

Sebastian Parborg noreply at git.blender.org
Tue Oct 5 18:57:25 CEST 2021


Commit: ebb81050c588bb39a3adf8664bc04f04382a02cb
Author: Sebastian Parborg
Date:   Tue Oct 5 18:49:45 2021 +0200
Branches: studio-sprite-fright
https://developer.blender.org/rBebb81050c588bb39a3adf8664bc04f04382a02cb

VSE: Free animation strip data if they are not visible

Previously we would only free animation strip data when doing final
renders. If not doing a final render or simply just playing back videos
in the VSE, we would not free decoders or non VSE cache data from the
strips.

This would lead to memory usage exploding in complex VSE scenes.

Now we instead use the dumb apporach of freeing everything that is not
currently visible.

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

M	source/blender/render/intern/pipeline.c
M	source/blender/sequencer/intern/render.c
M	source/blender/sequencer/intern/strip_relations.c

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

diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c
index 6c5f9a4ed4c..1685fab744a 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1466,7 +1466,7 @@ static void do_render_full_pipeline(Render *re)
 
   /* ensure no images are in memory from previous animated sequences */
   BKE_image_all_free_anim_ibufs(re->main, re->r.cfra);
-  SEQ_relations_free_all_anim_ibufs(re->scene, re->r.cfra);
+  SEQ_cache_cleanup(re->scene);
 
   if (RE_engine_render(re, true)) {
     /* in this case external render overrides all */
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index 6c4502a3608..41fb640a407 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -69,6 +69,7 @@
 #include "SEQ_iterator.h"
 #include "SEQ_modifier.h"
 #include "SEQ_proxy.h"
+#include "SEQ_relations.h"
 #include "SEQ_render.h"
 #include "SEQ_sequencer.h"
 #include "SEQ_time.h"
@@ -1950,6 +1951,8 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame,
   }
 
   seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame);
+  /* Make sure we only keep the `anim` data for strips that are in view. */
+  SEQ_relations_free_all_anim_ibufs(context->scene, timeline_frame);
 
   if (count && !out) {
     BLI_mutex_lock(&seq_render_mutex);
diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c
index 46fdd2c3d14..6b0452b69d5 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -354,7 +354,6 @@ void SEQ_relations_update_changed_seq_and_deps(Scene *scene,
   }
 }
 
-/* Unused */
 static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int timeline_frame)
 {
   for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) {
@@ -367,7 +366,6 @@ static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int timeline_frame)
   }
 }
 
-/* Unused */
 void SEQ_relations_free_all_anim_ibufs(Scene *scene, int timeline_frame)
 {
   Editing *ed = SEQ_editing_get(scene);
@@ -375,7 +373,6 @@ void SEQ_relations_free_all_anim_ibufs(Scene *scene, int timeline_frame)
     return;
   }
   sequencer_all_free_anim_ibufs(&ed->seqbase, timeline_frame);
-  SEQ_cache_cleanup(scene);
 }
 
 static Sequence *sequencer_check_scene_recursion(Scene *scene, ListBase *seqbase)



More information about the Bf-blender-cvs mailing list