[Bf-blender-cvs] [a31ebb52138] soc-2021-vse-strip-thumbnails: Fix limit on timeline_frame, remove global hash

Aditya Y Jeppu noreply at git.blender.org
Wed Aug 4 20:42:07 CEST 2021


Commit: a31ebb52138b373351c08f280e5465af1d07b005
Author: Aditya Y Jeppu
Date:   Thu Aug 5 00:11:01 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa31ebb52138b373351c08f280e5465af1d07b005

Fix limit on timeline_frame, remove global hash

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

M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/sequencer/SEQ_render.h
M	source/blender/sequencer/intern/render.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 6a0626ce460..3512171faf9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -103,7 +103,6 @@
 #define MUTE_ALPHA 120
 #define OVERLAP_ALPHA 180
 
-struct GHash *thumb_data_hash;
 static Sequence *special_seq_update = NULL;
 
 void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
@@ -1111,7 +1110,7 @@ static void thumbnail_hash_data_free(void *val)
 static void thumbnail_freejob(void *data)
 {
   ThumbnailDrawJob *tj = data;
-  // BLI_ghash_free(tj->seqs, NULL, thumbnail_hash_data_free);
+  BLI_ghash_free(tj->seqs, NULL, thumbnail_hash_data_free);
   MEM_freeN(tj->view_area);
   MEM_freeN(tj);
 }
@@ -1199,11 +1198,9 @@ static void thumbnail_startjob(void *data, short *stop, short *do_update, float
   Sequence *seq_orig;
   float start_frame, frame_step, temp_dummy = 0;
 
-  *do_update = true;
-
   GHashIterator gh_iter;
   BLI_ghashIterator_init(&gh_iter, tj->seqs);
-  while (!BLI_ghashIterator_done(&gh_iter)) {
+  while (!BLI_ghashIterator_done(&gh_iter) & !*stop) {
     seq_orig = BLI_ghashIterator_getKey(&gh_iter);
     val = BLI_ghash_lookup(tj->seqs, seq_orig);
 
@@ -1217,11 +1214,11 @@ static void thumbnail_startjob(void *data, short *stop, short *do_update, float
                                    tj->pixely);
       seq_thumbnail_get_start_frame(seq_orig, frame_step, &start_frame, tj->view_area);
       SEQ_render_thumbnails(
-          &tj->context, val->seq_dupli, seq_orig, start_frame, frame_step, tj->view_area);
+          &tj->context, val->seq_dupli, seq_orig, start_frame, frame_step, tj->view_area, stop);
     }
     BLI_ghashIterator_step(&gh_iter);
   }
-  UNUSED_VARS(stop, progress);
+  UNUSED_VARS(do_update, progress);
 }
 
 static void sequencer_thumbnail_get_job(const bContext *C,
@@ -1263,7 +1260,7 @@ static void sequencer_thumbnail_get_job(const bContext *C,
   }
   else {
     /* Free the hash input */
-    // BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
+    BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
   }
 
   if (!WM_jobs_is_running(wm_job)) {
@@ -1285,8 +1282,8 @@ static void thumbnail_call_for_job(const bContext *C, Editing *ed, View2D *v2d,
   SpaceSeq *sseq = CTX_wm_space_seq(C);
 
   /* Set the data for thumbnail caching job */
-  if (thumb_data_hash == NULL)
-    thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
+  GHash *thumb_data_hash;
+
   ThumbDataItem *val_need_update;
   // leftover is set to true if missing image in strip. false when normal call to all strips done
   if (v2d->cur.xmax != sseq->check_view_area.xmax || v2d->cur.ymax != sseq->check_view_area.ymax ||
@@ -1297,6 +1294,8 @@ static void thumbnail_call_for_job(const bContext *C, Editing *ed, View2D *v2d,
       WM_jobs_stop(CTX_wm_manager(C), NULL, thumbnail_startjob);
     }
 
+    thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
+
     LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
       if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL &&
           check_seq_need_thumbnails(seq, &v2d->cur)) {
diff --git a/source/blender/sequencer/SEQ_render.h b/source/blender/sequencer/SEQ_render.h
index 81459c79742..348d833643c 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -72,7 +72,8 @@ void SEQ_render_thumbnails(struct SeqRenderData *context,
                            struct Sequence *seq_orig,
                            float start_frame,
                            float frame_step,
-                           rctf *view_area);
+                           rctf *view_area,
+                           short *stop);
 struct ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
                                 struct Sequence *seq,
                                 float timeline_frame,
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index 01e8293a2c6..3006deb1748 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2107,15 +2107,17 @@ void SEQ_render_thumbnails(SeqRenderData *context,
                            Sequence *seq_orig,
                            float start_frame,
                            float frame_step,
-                           rctf *view_area)
+                           rctf *view_area,
+                           short *stop)
 {
   ImBuf *ibuf = NULL;
   SeqRenderState state;
   seq_render_state_init(&state);
 
   start_frame = start_frame - 5 * frame_step;
-  float upper_limit = view_area->xmax + 5 * frame_step;
-  while (start_frame < upper_limit) {
+  float upper_limit = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
+  upper_limit = (upper_limit > view_area->xmax) ? view_area->xmax + 3 * frame_step : upper_limit;
+  while ((start_frame < upper_limit) & !*stop) {
     ibuf = seq_cache_get(context, seq_orig, roundf(start_frame), SEQ_CACHE_STORE_THUMBNAIL);
     if (ibuf) {
       IMB_freeImBuf(ibuf);



More information about the Bf-blender-cvs mailing list