diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-10-19 00:13:05 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-10-19 00:26:16 +0300 |
commit | 3a898db3638d2ab13b4aa85e0dcce1fe35ae8695 (patch) | |
tree | 89eaca86afcc471c96ed53254985e247576a3d91 /source/blender | |
parent | 41eba47a877e3420246dfe2971eb6bbba2e39a17 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_thumbnails.c | 17 |
1 files changed, 17 insertions, 0 deletions
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); } |