[Bf-blender-cvs] [3a898db3638] master: VSE: Improve thumbnail loading speed

Richard Antalik noreply at git.blender.org
Mon Oct 18 23:26:34 CEST 2021


Commit: 3a898db3638d2ab13b4aa85e0dcce1fe35ae8695
Author: Richard Antalik
Date:   Mon Oct 18 23:13:05 2021 +0200
Branches: master
https://developer.blender.org/rB3a898db3638d2ab13b4aa85e0dcce1fe35ae8695

VSE: Improve thumbnail loading speed

Split thumbnail job in 2 passes. First pass will render visible images
and second part renders set of "guaranteed" equally spaced images.

When viewing larger amount of strips, it is likely that only 1 or 2
images will be rendered in first pass, while in second pass it is up to
30 images.

This results (seemingly) in 3x better performance, but zooming before
set of guaranteed images is done will be slightly more inaccurate.

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

M	source/blender/editors/space_sequencer/sequencer_thumbnails.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
index 557c233744e..06db96badc2 100644
--- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c
+++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
@@ -165,6 +165,8 @@ static void thumbnail_start_job(void *data,
   float start_frame, frame_step;
 
   GHashIterator gh_iter;
+
+  /* First pass: render visible images. */
   BLI_ghashIterator_init(&gh_iter, tj->sequences_ghash);
   while (!BLI_ghashIterator_done(&gh_iter) & !*stop) {
     Sequence *seq_orig = BLI_ghashIterator_getKey(&gh_iter);
@@ -176,6 +178,21 @@ static void thumbnail_start_job(void *data,
       start_frame = seq_thumbnail_get_start_frame(seq_orig, frame_step, tj->view_area);
       SEQ_render_thumbnails(
           &tj->context, val->seq_dupli, seq_orig, start_frame, frame_step, tj->view_area, stop);
+      SEQ_relations_sequence_free_anim(val->seq_dupli);
+    }
+    BLI_ghashIterator_step(&gh_iter);
+  }
+
+  /* Second pass: render "guaranteed" set of images. */
+  BLI_ghashIterator_init(&gh_iter, tj->sequences_ghash);
+  while (!BLI_ghashIterator_done(&gh_iter) & !*stop) {
+    Sequence *seq_orig = BLI_ghashIterator_getKey(&gh_iter);
+    ThumbDataItem *val = BLI_ghash_lookup(tj->sequences_ghash, seq_orig);
+
+    if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
+      seq_get_thumb_image_dimensions(
+          val->seq_dupli, tj->pixelx, tj->pixely, &frame_step, NULL, NULL, NULL);
+      start_frame = seq_thumbnail_get_start_frame(seq_orig, frame_step, tj->view_area);
       SEQ_render_thumbnails_base_set(&tj->context, val->seq_dupli, seq_orig, tj->view_area, stop);
       SEQ_relations_sequence_free_anim(val->seq_dupli);
     }



More information about the Bf-blender-cvs mailing list