[Bf-blender-cvs] [997b5fe45da] master: VSE strip thumbnails

2021-09-21 Thread Aditya Y Jeppu
Commit: 997b5fe45dab8bd0e2976c8b673e56266134fc80
Author: Aditya Y Jeppu
Date:   Tue Sep 21 10:38:15 2021 +0200
Branches: master
https://developer.blender.org/rB997b5fe45dab8bd0e2976c8b673e56266134fc80

VSE strip thumbnails

Draw thumbnails as strip overlay. This works for movie and image strips.
To draw thumbnails, this overlay has to be enabled and strips must be
tall enough.

The thumbnails are loaded from source file using separate thread and
stored in cache.

Drawing code uses only images stored in cache, and if any is missing,
background rendering job is started. If job can not render thumbnail,
to prevent endless loop of creating job for missing image it sets
`SEQ_FLAG_SKIP_THUMBNAILS` bit of `Sequence` flag.

To prevent visual glitches during timeline panning and zooming, `View2D`
flag `V2D_IS_NAVIGATING` is implemented. If bit is set, drawing code
will look for set of evenly distributed thumbnails that should be
guaranteed to exist and also set of previously displayed thumbnails.
Due to volatile nature of cache these thumbnails can be missing anyway,
in which case no new thumbnails will be drawn for particular strip.

Cache capacity is limited to 5000 thumbnails and performs cleanup of
non visible images when limit is reached.

ref T89143

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12266

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenkernel/intern/screen.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/interface/view2d_ops.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/space_sequencer/sequencer_intern.h
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesdna/DNA_view2d_types.h
M   source/blender/makesrna/intern/rna_space.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/SEQ_utils.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.h
M   source/blender/sequencer/intern/render.c
M   source/blender/sequencer/intern/sequencer.c
M   source/blender/sequencer/intern/utils.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_jobs.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 806b6100cc8..543164f25fc 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -247,6 +247,7 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
 
 layout.prop(overlay_settings, "show_strip_offset", text="Offsets")
 layout.prop(overlay_settings, "show_fcurves", text="F-Curves")
+layout.prop(overlay_settings, "show_thumbnails", text="Thumbnails")
 layout.prop(overlay_settings, "show_grid", text="Grid")
 
 layout.separator()
diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 73e25a5..4c38536b662 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1679,6 +1679,8 @@ static void direct_link_area(BlendDataReader *reader, 
ScrArea *area)
   sseq->scopes.sep_waveform_ibuf = NULL;
   sseq->scopes.vector_ibuf = NULL;
   sseq->scopes.histogram_ibuf = NULL;
+  memset(>runtime, 0x0, sizeof(sseq->runtime));
+
 }
 else if (sl->spacetype == SPACE_PROPERTIES) {
   SpaceProperties *sbuts = (SpaceProperties *)sl;
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index f667361d166..9f2c090c242 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1774,7 +1774,7 @@ static void do_versions_seq_set_cache_defaults(Editing 
*ed)
 
 static bool seq_update_flags_cb(Sequence *seq, void *UNUSED(user_data))
 {
-  seq->flag &= ~(SEQ_FLAG_UNUSED_6 | SEQ_FLAG_UNUSED_18 | SEQ_FLAG_UNUSED_19 | 
SEQ_FLAG_UNUSED_21);
+  seq->flag &= ~((1 << 6) | (1 << 18) | (1 << 19) | (1 << 21));
   if (seq->type == SEQ_TYPE_SPEED) {
 SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
 s->flags &= ~(SEQ_SPEED_UNUSED_1);
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/

[Bf-blender-cvs] [6f908dffe22] soc-2021-vse-strip-thumbnails: V2D navigating flag by Richard Antalik

2021-09-13 Thread Aditya Y Jeppu
Commit: 6f908dffe226f77e9dc5198a791b332ae0bd25d5
Author: Aditya Y Jeppu
Date:   Mon Sep 13 18:27:05 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB6f908dffe226f77e9dc5198a791b332ae0bd25d5

V2D navigating flag by Richard Antalik

===

M   source/blender/editors/interface/view2d_ops.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/makesdna/DNA_view2d_types.h

===

diff --git a/source/blender/editors/interface/view2d_ops.c 
b/source/blender/editors/interface/view2d_ops.c
index 1fd1b6c984d..3afbcf78851 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -147,6 +147,8 @@ static void view_pan_init(bContext *C, wmOperator *op)
   const float winy = (float)(BLI_rcti_size_y(>region->winrct) + 1);
   vpd->facx = (BLI_rctf_size_x(>v2d->cur)) / winx;
   vpd->facy = (BLI_rctf_size_y(>v2d->cur)) / winy;
+
+  vpd->v2d->flag |= V2D_IS_NAVIGATING;
 }
 
 /* apply transform to view (i.e. adjust 'cur' rect) */
@@ -190,6 +192,8 @@ static void view_pan_apply(bContext *C, wmOperator *op)
 /* Cleanup temp custom-data. */
 static void view_pan_exit(wmOperator *op)
 {
+  v2dViewPanData *vpd = op->customdata;
+  vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
   MEM_SAFE_FREE(op->customdata);
 }
 
@@ -305,7 +309,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   return OPERATOR_RUNNING_MODAL;
 }
 
-static void view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
+static void view_pan_cancel(bContext *C, wmOperator *op)
 {
   view_pan_exit(op);
 }
@@ -358,6 +362,7 @@ static int view_edge_pan_modal(bContext *C, wmOperator *op, 
const wmEvent *event
   View2DEdgePanData *vpd = op->customdata;
 
   if (event->val == KM_RELEASE || event->type == EVT_ESCKEY) {
+vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
 MEM_SAFE_FREE(op->customdata);
 return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
   }
@@ -371,6 +376,8 @@ static int view_edge_pan_modal(bContext *C, wmOperator *op, 
const wmEvent *event
 
 static void view_edge_pan_cancel(bContext *UNUSED(C), wmOperator *op)
 {
+  v2dViewPanData *vpd = op->customdata;
+  vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
   MEM_SAFE_FREE(op->customdata);
 }
 
@@ -680,6 +687,8 @@ static void view_zoomdrag_init(bContext *C, wmOperator *op)
   vzd->v2d = >region->v2d;
   /* False by default. Interactive callbacks (ie invoke()) can set it to true. 
*/
   vzd->zoom_to_mouse_pos = false;
+
+  vzd->v2d->flag |= V2D_IS_NAVIGATING;
 }
 
 /* apply transform to view (i.e. adjust 'cur' rect) */
@@ -809,7 +818,8 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
 static void view_zoomstep_exit(wmOperator *op)
 {
   UI_view2d_zoom_cache_reset();
-
+  v2dViewZoomData *vzd = op->customdata;
+  vzd->v2d->flag &= ~V2D_IS_NAVIGATING;
   MEM_SAFE_FREE(op->customdata);
 }
 
@@ -1041,6 +1051,7 @@ static void view_zoomdrag_exit(bContext *C, wmOperator 
*op)
 
   if (op->customdata) {
 v2dViewZoomData *vzd = op->customdata;
+vzd->v2d->flag &= ~V2D_IS_NAVIGATING;
 
 if (vzd->timer) {
   WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), vzd->timer);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 1ec6d9dc4a7..b4363db1e71 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1375,12 +1375,12 @@ static void seq_get_thumb_image_dimensions(Sequence 
*seq,
 
 static float seq_thumbnail_get_start_frame(Sequence *seq, float frame_step, 
rctf *view_area)
 {
-  if (seq->start > view_area->xmin && seq->start < view_area->xmax) {
+  if (seq->start > view_area->xmin) {
 return seq->start;
   }
 
-  /* Drawing and caching both check to see if strip is in view area or not 
before calling this
-   * function so assuming strip/part of strip in view. */
+  /* Drawing and caching both check to see if stristart_framep is in view area 
or not before
+   * calling this function so assuming strip/part of strip in view. */
 
   int no_invisible_thumbs = (view_area->xmin - seq->start) / frame_step;
   return ((no_invisible_thumbs - 1) * frame_step) + seq->start;
@@ -1505,6 +1505,11 @@ static void 
sequencer_thumbnail_start_job_if_necessary(const bContext *C,
 {
   SpaceSeq *sseq = CTX_wm_space_seq(C);
 
+  if ((v2d->flag & V2D_IS_NAVIGATING) != 0) {
+WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL);
+return;
+  }
+
   /* Leftover is set to true if missing image in strip. False when normal call 
to all strips done.
*/
   if (v2d->cur.xmax !=

[Bf-blender-cvs] [c9e4808d363] temp-vse-thumbnail-mod: VSE strip thumbnails

2021-09-08 Thread Aditya Y Jeppu
Commit: c9e4808d3638bd1fd39341229996247a79455e99
Author: Aditya Y Jeppu
Date:   Wed Sep 8 00:22:45 2021 +0200
Branches: temp-vse-thumbnail-mod
https://developer.blender.org/rBc9e4808d3638bd1fd39341229996247a79455e99

VSE strip thumbnails

The goal is to provide thumbnails in the rectangle coloured strips. Works for
movie clips and image sequences. The thumbnails are loaded from source
using separate thread and stores them in cache. The drawing is called inside the
drawing for each strip, and takes images from cache. Drawing is below the
handles from one end of strip to other, inside view only. The job for caching
is called when images are not available, or there is view change.

All strip operations are valid, and overlap of strip adds transparency to the
image. Images are shown only when strip size is wide enough for clear
visibility of images, and the thumbnails represent source footage clearly.

Cache is limited to 5000 thumbnails and performs cleanup of non visible images
when limit crossed.

Related Task : T89143

Maniphest Tasks: T89143

Differential Revision: https://developer.blender.org/D12266

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.h
M   source/blender/sequencer/intern/render.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_jobs.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 30115618f3d..1905b990eba 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -250,7 +250,8 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
 layout.prop(st, "show_strip_offset", text="Offsets")
 layout.prop(st, "show_fcurves", text="F-Curves")
 layout.prop(st, "show_grid", text="Grid")
-
+layout.prop(st, "show_thumbnails", text="Thumbnails")
+
 layout.separator()
 
 layout.prop_menu_enum(st, "waveform_display_type")
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index f050de6e6e9..bb7f12612ac 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1084,6 +1084,32 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 20)) {
+LISTBASE_FOREACH (bScreen *, screen, >screens) {
+  LISTBASE_FOREACH (ScrArea *, area, >areabase) {
+LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
+  if (sl->spacetype == SPACE_SEQ) {
+SpaceSeq *sseq = (SpaceSeq *)sl;
+sseq->flag |= SEQ_SHOW_THUMBNAILS;
+  }
+}
+  }
+}
+  }
+
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 21)) {
+LISTBASE_FOREACH (bScreen *, screen, >screens) {
+  LISTBASE_FOREACH (ScrArea *, area, >areabase) {
+LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
+  if (sl->spacetype == SPACE_SEQ) {
+SpaceSeq *sseq = (SpaceSeq *)sl;
+sseq->flag |= SEQ_SHOW_THUMBNAILS;
+  }
+}
+  }
+}
+  }
+
   /**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 82c577d11a0..ac5696b7ef0 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -157,7 +157,7 @@ static void blo_update_defaults_screen(bScreen *screen,
   SpaceSeq *seq = area->spacedata.first;
   seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | 
SEQ_SHOW_STRIP_OVERLAY |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | 
SEQ_SHOW_STRIP_DURATION |
-   SEQ_SHOW_GRID;
+   SEQ_SHOW_GRID | SEQ_SHOW_THUMBNAILS;
 
   seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
   seq->flag |= SEQ_USE_PROXIES;
diff --git 

[Bf-blender-cvs] [f3d3e125b77] soc-2021-vse-strip-thumbnails: Small fix of using defined constant instead of immediate value

2021-09-03 Thread Aditya Y Jeppu
Commit: f3d3e125b774774648f0c9ec84741d3e2c7ef578
Author: Aditya Y Jeppu
Date:   Fri Sep 3 14:53:29 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf3d3e125b774774648f0c9ec84741d3e2c7ef578

Small fix of using defined constant instead of immediate value

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 1966f9bc06d..1ec6d9dc4a7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1345,14 +1345,14 @@ static void seq_get_thumb_image_dimensions(Sequence 
*seq,
   float image_width = seq->strip->stripdata->orig_width;
   float image_height = seq->strip->stripdata->orig_height;
 
-  /* Fix the dimensions to be max 256 for x or y. */
+  /* Fix the dimensions to be max SEQ_RENDER_THUMB_SIZE (256) for x or y. */
   float aspect_ratio = (float)image_width / image_height;
   if (image_width > image_height) {
-image_width = 256;
+image_width = SEQ_RENDER_THUMB_SIZE;
 image_height = round_fl_to_int(image_width / aspect_ratio);
   }
   else {
-image_height = 256;
+image_height = SEQ_RENDER_THUMB_SIZE;
 image_width = round_fl_to_int(image_height * aspect_ratio);
   }
 
@@ -1461,7 +1461,7 @@ static void sequencer_thumbnail_init_job(const bContext 
*C, View2D *v2d, Editing
CTX_wm_window(C),
CTX_data_scene(C),
"Draw Thumbnails",
-   WM_JOB_PROGRESS,  // TODO(AYJ): change this and use 
SEQ_RENDER_THUMB_SIZE
+   0,
WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL);
 
   /* Get the thumbnail job if it exists. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6b8a5e78ded] soc-2021-vse-strip-thumbnails: Add changes requested in D12266

2021-09-03 Thread Aditya Y Jeppu
Commit: 6b8a5e78ded37fa025df9e5b0d4f8758dda2b3a8
Author: Aditya Y Jeppu
Date:   Thu Sep 2 21:58:33 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB6b8a5e78ded37fa025df9e5b0d4f8758dda2b3a8

Add changes requested in D12266

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.h
M   source/blender/sequencer/intern/render.c

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 5dc4ebaa7a4..e2788020628 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 20
+#define BLENDER_FILE_SUBVERSION 21
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the 
file
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 91c00abb9ce..e72bbf7aad2 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -958,7 +958,7 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
   if (sl->spacetype == SPACE_SEQ) {
 SpaceSeq *sseq = (SpaceSeq *)sl;
-sseq->flag |= SEQ_SHOW_GRID | SEQ_SHOW_THUMBNAILS;
+sseq->flag |= SEQ_SHOW_GRID;
   }
 }
   }
@@ -,6 +,32 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 20)) {
+LISTBASE_FOREACH (bScreen *, screen, >screens) {
+  LISTBASE_FOREACH (ScrArea *, area, >areabase) {
+LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
+  if (sl->spacetype == SPACE_SEQ) {
+SpaceSeq *sseq = (SpaceSeq *)sl;
+sseq->flag |= SEQ_SHOW_THUMBNAILS;
+  }
+}
+  }
+}
+  }
+
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 21)) {
+LISTBASE_FOREACH (bScreen *, screen, >screens) {
+  LISTBASE_FOREACH (ScrArea *, area, >areabase) {
+LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
+  if (sl->spacetype == SPACE_SEQ) {
+SpaceSeq *sseq = (SpaceSeq *)sl;
+sseq->flag |= SEQ_SHOW_THUMBNAILS;
+  }
+}
+  }
+}
+  }
+
   /**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 47bb7ead93f..ef2f6fe7178 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1280,7 +1280,7 @@ static void draw_seq_fcurve_overlay(
 
 typedef struct ThumbnailDrawJob {
   SeqRenderData context;
-  GHash *seqs;
+  GHash *sequences_ghash;
   Scene *scene;
   rctf *view_area;
   float pixelx;
@@ -1302,7 +1302,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->sequences_ghash, NULL, thumbnail_hash_data_free);
   MEM_freeN(tj->view_area);
   MEM_freeN(tj);
 }
@@ -1334,13 +1334,13 @@ static bool check_seq_need_thumbnails(Sequence *seq, 
rctf *view_area)
   return true;
 }
 
-static void seq_thumbnail_get_frame_step(Sequence *seq,
- float pixelx,
- float pixely,
- float *r_thumb_w,
- float *r_thumb_h,
- float *r_image_x,
- float *r_image_y)
+static void seq_get_thumb_image_dimensions(Sequence *seq,
+   float pixelx,
+   float pixely,
+   float *r_thumb_width,
+   float *r_thumb_height,
+   float *r_i

[Bf-blender-cvs] [14d7721836c] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-09-03 Thread Aditya Y Jeppu
Commit: 14d7721836c9d60d3263f1163955bd675f7a5529
Author: Aditya Y Jeppu
Date:   Thu Sep 2 22:06:56 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB14d7721836c9d60d3263f1163955bd675f7a5529

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f9094bbc408] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-09-01 Thread Aditya Y Jeppu
Commit: f9094bbc40854aeb59ee2811d0f7a521626c7d90
Author: Aditya Y Jeppu
Date:   Wed Sep 1 14:41:09 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf9094bbc40854aeb59ee2811d0f7a521626c7d90

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e600fc482fb] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-30 Thread Aditya Y Jeppu
Commit: e600fc482fb9de48ea459559d54a4f976209ba44
Author: Aditya Y Jeppu
Date:   Mon Aug 30 15:07:49 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBe600fc482fb9de48ea459559d54a4f976209ba44

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bec129af27c] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-30 Thread Aditya Y Jeppu
Commit: bec129af27ca8e205cd865f423b2260f00513359
Author: Aditya Y Jeppu
Date:   Sun Aug 22 20:49:41 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBbec129af27ca8e205cd865f423b2260f00513359

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===

diff --cc source/blender/sequencer/intern/image_cache.c
index c3112a9933f,86bd840ce31..6190abde195
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@@ -102,9 -102,8 +102,9 @@@
  /* -x-%()-.dcf */
  #define DCACHE_FNAME_FORMAT "%d-%dx%d-%d%%(%d)-%d.dcf"
  #define DCACHE_IMAGES_PER_FILE 100
- #define DCACHE_CURRENT_VERSION 1
+ #define DCACHE_CURRENT_VERSION 2
  #define COLORSPACE_NAME_MAX 64 /* XXX: defined in imb intern */
 +#define THUMB_CACHE_LIMIT 5000
  
  typedef struct DiskCacheHeaderEntry {
unsigned char encoding;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a68cdab2137] soc-2021-vse-strip-thumbnails: Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into soc-2021-vse-strip-thumbnails

2021-08-30 Thread Aditya Y Jeppu
Commit: a68cdab21378991f42f9f7fe44282dcb2441b96d
Author: Aditya Y Jeppu
Date:   Sun Aug 22 20:49:29 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa68cdab21378991f42f9f7fe44282dcb2441b96d

Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into 
soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9cb616d8aa4] soc-2021-vse-strip-thumbnails: VSE strip thumbnails

2021-08-30 Thread Aditya Y Jeppu
Commit: 9cb616d8aa490e8e6d78525a5c04188d989778b2
Author: Aditya Y Jeppu
Date:   Thu Aug 19 14:56:47 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB9cb616d8aa490e8e6d78525a5c04188d989778b2

VSE strip thumbnails

The goal is to provide thumbnails in the rectangle coloured strips. Works for
movie clips and image sequences. The thumbnails are loaded from source
using separate thread and stores them in cache. The drawing is called inside the
drawing for each strip, and takes images from cache. Drawing is below the
handles from one end of strip to other, inside view only. The job for caching
is called when images are not available, or there is view change.

All strip operations are valid, and overlap of strip adds transparency to the
image. Images are shown only when strip size is wide enough for clear
visibility of images, and the thumbnails represent source footage clearly.

Cache is limited to 5000 thumbnails and performs cleanup of non visible images
when limit crossed.

Related Task : T89143

Differential Revision: https://developer.blender.org/D12266

===

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

===

diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index a3222607845..b0eac569aa1 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2107,7 +2107,7 @@ void SEQ_render_thumbnails(SeqRenderData *context,
 
   start_frame = start_frame - 5 * frame_step;
   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;
+  upper_limit = (upper_limit > view_area->xmax) ? view_area->xmax + 5 * 
frame_step : upper_limit;
 
   while ((start_frame < upper_limit) & !*stop) {
 ibuf = seq_cache_get(context, seq_orig, roundf(start_frame), 
SEQ_CACHE_STORE_THUMBNAIL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5d43ea0155a] soc-2021-vse-strip-thumbnails: Fix limits on additional thumbs rendered.

2021-08-19 Thread Aditya Y Jeppu
Commit: 5d43ea0155afa9c6abf3d93c677c263d2afc56e5
Author: Aditya Y Jeppu
Date:   Thu Aug 19 14:56:47 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB5d43ea0155afa9c6abf3d93c677c263d2afc56e5

Fix limits on additional thumbs rendered.

===

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

===

diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index a3222607845..b0eac569aa1 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2107,7 +2107,7 @@ void SEQ_render_thumbnails(SeqRenderData *context,
 
   start_frame = start_frame - 5 * frame_step;
   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;
+  upper_limit = (upper_limit > view_area->xmax) ? view_area->xmax + 5 * 
frame_step : upper_limit;
 
   while ((start_frame < upper_limit) & !*stop) {
 ibuf = seq_cache_get(context, seq_orig, roundf(start_frame), 
SEQ_CACHE_STORE_THUMBNAIL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [95162f2aa9b] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-19 Thread Aditya Y Jeppu
Commit: 95162f2aa9b1e40a18311c49b8113d7891d19829
Author: Aditya Y Jeppu
Date:   Thu Aug 19 13:34:00 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB95162f2aa9b1e40a18311c49b8113d7891d19829

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [427265785d9] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-19 Thread Aditya Y Jeppu
Commit: 427265785d96a8590f72b3174044c5c0cfd5731b
Author: Aditya Y Jeppu
Date:   Thu Aug 19 11:55:55 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB427265785d96a8590f72b3174044c5c0cfd5731b

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1ed0d1971c0] soc-2021-vse-strip-thumbnails: Fix : Last thumb with error in crop values

2021-08-17 Thread Aditya Y Jeppu
Commit: 1ed0d1971c08bede70abb97c8ae264cacd718caf
Author: Aditya Y Jeppu
Date:   Tue Aug 17 23:20:18 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB1ed0d1971c08bede70abb97c8ae264cacd718caf

Fix : Last thumb with error in crop values

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index dc76c273233..ec2ec22d24b 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1596,7 +1596,10 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
 cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
-BLI_rcti_init(, (int)(cropx_min), (int)cropx_max + 1, 0, 
(int)(image_y)-1);
+if (cropx_max == (x2 - x1)) {
+  cropx_max = cropx_max + 1;
+}
+BLI_rcti_init(, (int)(cropx_min), (int)cropx_max, 0, 
(int)(image_y)-1);
 
 /* Get the image. */
 ibuf = SEQ_get_thumbnail(, seq, roundf(x1), , clipped);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0973ec24a54] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-17 Thread Aditya Y Jeppu
Commit: 0973ec24a54a6f8a9833e6e026b1ab55679457ae
Author: Aditya Y Jeppu
Date:   Tue Aug 17 23:22:21 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB0973ec24a54a6f8a9833e6e026b1ab55679457ae

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8edbbf2221b] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-16 Thread Aditya Y Jeppu
Commit: 8edbbf2221b01c94ede38268863f0079787ddcee
Author: Aditya Y Jeppu
Date:   Mon Aug 16 23:26:58 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB8edbbf2221b01c94ede38268863f0079787ddcee

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [95ca2cd634d] soc-2021-vse-strip-thumbnails: Fix : Switching off overlay now turns off thumbnails also

2021-08-16 Thread Aditya Y Jeppu
Commit: 95ca2cd634d887f86a6da0d0605652dde1fe0121
Author: Aditya Y Jeppu
Date:   Mon Aug 16 19:50:06 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB95ca2cd634d887f86a6da0d0605652dde1fe0121

Fix : Switching off overlay now turns off thumbnails also

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 4d7a90993fa..c26154179b1 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1507,7 +1507,7 @@ static void draw_seq_strip(const bContext *C,
 drawmeta_contents(scene, seq, x1, y1, x2, y2);
   }
 
-  if ((sseq->flag & SEQ_SHOW_THUMBNAILS) &&
+  if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & 
SEQ_SHOW_THUMBNAILS) &&
   (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE)) {
 draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ee78603b35e] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-16 Thread Aditya Y Jeppu
Commit: ee78603b35e1cc6cf5e3ee89bde24a2700bd3de0
Author: Aditya Y Jeppu
Date:   Mon Aug 16 10:18:37 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBee78603b35e1cc6cf5e3ee89bde24a2700bd3de0

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bf97bfb0ea9] soc-2021-vse-strip-thumbnails: Cleanup : C/C++ code style format

2021-08-15 Thread Aditya Y Jeppu
Commit: bf97bfb0ea9544c67ca72ee984005473e8e58cb2
Author: Aditya Y Jeppu
Date:   Sun Aug 15 19:02:42 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBbf97bfb0ea9544c67ca72ee984005473e8e58cb2

Cleanup : C/C++ code style format

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
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 79bd374e3cc..4d7a90993fa 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1123,6 +1123,9 @@ static void thumbnail_endjob(void *data)
 
 static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
 {
+  if (seq->type != SEQ_TYPE_MOVIE && seq->type != SEQ_TYPE_IMAGE) {
+return false;
+  }
   if (min_ii(seq->startdisp, seq->start) > view_area->xmax) {
 return false;
   }
@@ -1135,24 +1138,22 @@ static bool check_seq_need_thumbnails(Sequence *seq, 
rctf *view_area)
   else if (seq->machine > view_area->ymax) {
 return false;
   }
-  if (seq->type != SEQ_TYPE_MOVIE && seq->type != SEQ_TYPE_IMAGE) {
-return false;
-  }
+
   return true;
 }
 
 static void seq_thumbnail_get_frame_step(Sequence *seq,
- float *thumb_w,
- float *thumb_h,
- float *image_x,
- float *image_y,
  float pixelx,
- float pixely)
+ float pixely,
+ float *r_thumb_w,
+ float *r_thumb_h,
+ float *r_image_x,
+ float *r_image_y)
 {
   float image_width = seq->strip->stripdata->orig_width;
   float image_height = seq->strip->stripdata->orig_height;
 
-  /* Fix the dimensions to be max 256 for x or y */
+  /* Fix the dimensions to be max 256 for x or y. */
   float aspect_ratio = (float)image_width / image_height;
   if (image_width > image_height) {
 image_width = 256;
@@ -1163,32 +1164,38 @@ static void seq_thumbnail_get_frame_step(Sequence *seq,
 image_width = round_fl_to_int(image_height * aspect_ratio);
   }
 
-  /*Calculate thumb dimensions */
+  /* Calculate thumb dimensions. */
   float thumb_height = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * 
U.dpi_fac * pixely);
   aspect_ratio = ((float)image_width) / image_height;
   float thumb_h_px = thumb_height / pixely;
   float thumb_width = aspect_ratio * thumb_h_px * pixelx;
 
-  *image_x = image_width;
-  *image_y = image_height;
-  *thumb_w = thumb_width;
-  *thumb_h = thumb_height;
+  if (r_thumb_h == NULL) {
+*r_thumb_w = thumb_width;
+return;
+  }
+
+  *r_thumb_h = thumb_height;
+  *r_image_x = image_width;
+  *r_image_y = image_height;
+  *r_thumb_w = thumb_width;
 }
 
 static void seq_thumbnail_get_start_frame(Sequence *seq,
   float frame_step,
-  float *start_frame,
-  rctf *view_area)
+  rctf *view_area,
+  float *r_start_frame)
 {
   if (seq->start > view_area->xmin && seq->start < view_area->xmax) {
-*start_frame = seq->start;
+*r_start_frame = seq->start;
 return;
   }
+
   /* Drawing and caching both check to see if strip is in view area or not 
before calling this
-   * function so assuming strip/part of strip in view */
+   * function so assuming strip/part of strip in view. */
 
   int no_invisible_thumbs = (view_area->xmin - seq->start) / frame_step;
-  *start_frame = ((no_invisible_thumbs - 1) * frame_step) + seq->start;
+  *r_start_frame = ((no_invisible_thumbs - 1) * frame_step) + seq->start;
 }
 
 static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
@@ -1196,7 +1203,7 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
   ThumbnailDrawJob *tj = data;
   ThumbDataItem *val;
   Sequence *seq_orig;
-  float start_frame, frame_step, temp_dummy = 0;
+  float start_frame, frame_step;
 
   GHashIterator gh_iter;
   BLI_ghashIterator_init(_iter, tj->seqs);
@@ -1205,14 +1212,9 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
 val = BLI_ghash_lookup(tj->s

[Bf-blender-cvs] [a224bcbcfcf] soc-2021-vse-strip-thumbnails: Correct Fix for pixel errors in the first thumbanail for each strip.

2021-08-15 Thread Aditya Y Jeppu
Commit: a224bcbcfcff721368bcdea1fed3a5943da597e6
Author: Aditya Y Jeppu
Date:   Sun Aug 15 15:24:43 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa224bcbcfcff721368bcdea1fed3a5943da597e6

Correct Fix for pixel errors in the first thumbanail for each strip.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/imbuf/intern/rectop.c
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 04a38c2c3fd..79bd374e3cc 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1402,7 +1402,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
 cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
-BLI_rcti_init(, (int)(cropx_min), (int)image_x, 0, (int)(image_y)-1);
+BLI_rcti_init(, (int)(cropx_min), (int)cropx_max + 1, 0, 
(int)(image_y)-1);
 
 /* Get the image */
 ibuf = SEQ_get_thumbnail(, seq, roundf(x1), , clipped, false);
diff --git a/source/blender/imbuf/intern/rectop.c 
b/source/blender/imbuf/intern/rectop.c
index e3e21cf83ef..4b5d68b9c13 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -266,7 +266,7 @@ void IMB_rect_crop(ImBuf *ibuf, const rcti *crop)
   };
   BLI_assert(size_dst[0] > 0 && size_dst[1] > 0);
   BLI_assert(crop->xmin >= 0 && crop->ymin >= 0);
-  BLI_assert(crop->xmax <= ibuf->x && crop->ymax <= ibuf->y);
+  BLI_assert(crop->xmax < ibuf->x && crop->ymax < ibuf->y);
 
   if ((size_dst[0] == ibuf->x) && (size_dst[1] == ibuf->y)) {
 return;
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 7e43950edca..3006deb1748 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2087,6 +2087,10 @@ ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
   crop->xmin = 0;
   crop->ymin = 0;
 }
+if (crop->xmax >= ibuf->x || crop->ymax >= ibuf->y) {
+  crop->xmax = ibuf->x - 1;
+  crop->ymax = ibuf->y - 1;
+}
 IMB_rect_crop(temp, crop);
 if (temp != NULL) {
   IMB_freeImBuf(ibuf);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3de92e5f218] soc-2021-vse-strip-thumbnails: Fix pixel errors when drawing first thumb

2021-08-14 Thread Aditya Y Jeppu
Commit: 3de92e5f21838902670403207e81bcaa627b938b
Author: Aditya Y Jeppu
Date:   Sat Aug 14 23:42:39 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB3de92e5f21838902670403207e81bcaa627b938b

Fix pixel errors when drawing first thumb

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/imbuf/intern/rectop.c
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 05134910830..04a38c2c3fd 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1321,9 +1321,6 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   }
 }
 
-/* TODO(AYJ) : Decrease Opacity of images when overlay over another strip
- */
-
 static void draw_seq_strip_thumbnail(View2D *v2d,
  const bContext *C,
  SpaceSeq *sseq,
@@ -1403,10 +1400,9 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 break;
 }
 
-// TODO(AYJ) : Fix pixel errors in the first frame when cropping
 cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
 cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
-BLI_rcti_init(, (int)(cropx_min), (int)(cropx_max)-1, 0, 
(int)(image_y)-1);
+BLI_rcti_init(, (int)(cropx_min), (int)image_x, 0, (int)(image_y)-1);
 
 /* Get the image */
 ibuf = SEQ_get_thumbnail(, seq, roundf(x1), , clipped, false);
diff --git a/source/blender/imbuf/intern/rectop.c 
b/source/blender/imbuf/intern/rectop.c
index 4b5d68b9c13..e3e21cf83ef 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -266,7 +266,7 @@ void IMB_rect_crop(ImBuf *ibuf, const rcti *crop)
   };
   BLI_assert(size_dst[0] > 0 && size_dst[1] > 0);
   BLI_assert(crop->xmin >= 0 && crop->ymin >= 0);
-  BLI_assert(crop->xmax < ibuf->x && crop->ymax < ibuf->y);
+  BLI_assert(crop->xmax <= ibuf->x && crop->ymax <= ibuf->y);
 
   if ((size_dst[0] == ibuf->x) && (size_dst[1] == ibuf->y)) {
 return;
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 3006deb1748..7e43950edca 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2087,10 +2087,6 @@ ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
   crop->xmin = 0;
   crop->ymin = 0;
 }
-if (crop->xmax >= ibuf->x || crop->ymax >= ibuf->y) {
-  crop->xmax = ibuf->x - 1;
-  crop->ymax = ibuf->y - 1;
-}
 IMB_rect_crop(temp, crop);
 if (temp != NULL) {
   IMB_freeImBuf(ibuf);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b20e00bda7e] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-14 Thread Aditya Y Jeppu
Commit: b20e00bda7e6381583a1f711225cb19381162b3d
Author: Aditya Y Jeppu
Date:   Sat Aug 14 23:47:24 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBb20e00bda7e6381583a1f711225cb19381162b3d

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e66dc4becaa] soc-2021-vse-strip-thumbnails: Remove progress bar. Make transparent images on overlap during Transform

2021-08-13 Thread Aditya Y Jeppu
Commit: e66dc4becaa5b057f1eb1eb128ecc212f3bb7b7b
Author: Aditya Y Jeppu
Date:   Sat Aug 14 00:21:23 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBe66dc4becaa5b057f1eb1eb128ecc212f3bb7b7b

Remove progress bar. Make transparent images on overlap during Transform

===

M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/windowmanager/intern/wm_jobs.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 862ef99fca5..854c3f9984e 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -698,7 +698,7 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
   if (sl->spacetype == SPACE_SEQ) {
 SpaceSeq *sseq = (SpaceSeq *)sl;
-sseq->flag |= SEQ_SHOW_GRID;
+sseq->flag |= SEQ_SHOW_GRID | SEQ_SHOW_THUMBNAILS;
   }
 }
   }
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index a1818a44de6..05134910830 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1233,7 +1233,7 @@ static void sequencer_thumbnail_get_job(const bContext *C,
CTX_wm_window(C),
CTX_data_scene(C),
"Draw Thumbnails",
-   WM_JOB_PROGRESS,
+   1 << 3,
WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL);
 
   /* Get the thumbnail job if it exists. */
@@ -1321,8 +1321,7 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   }
 }
 
-/* TODO(AYJ) : 1) Add operator to choose whether thumbnails required by user 
or not in overlay menu
- * 2) Decrease Opacity of images when overlay over another strip
+/* TODO(AYJ) : Decrease Opacity of images when overlay over another strip
  */
 
 static void draw_seq_strip_thumbnail(View2D *v2d,
@@ -1411,8 +1410,17 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 /* Get the image */
 ibuf = SEQ_get_thumbnail(, seq, roundf(x1), , clipped, false);
+int tot;
 
 if (ibuf) {
+  if (seq->flag & SEQ_OVERLAP) {
+GPU_blend(GPU_BLEND_ALPHA);
+unsigned char *buf = (unsigned char *)ibuf->rect;
+for (tot = ibuf->x * ibuf->y; tot--; buf += 4) {
+  buf[3] = OVERLAP_ALPHA;
+}
+  }
+
   ED_draw_imbuf_ctx_clipping(
   C, ibuf, x1 + cut_off, y1, true, x1 + cut_off, y1, x2, y2, zoom_x, 
zoom_y);
   IMB_freeImBuf(ibuf);
@@ -1420,7 +1428,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 else {
   thumbnail_call_for_job(C, scene->ed, v2d, true);
 }
-
+GPU_blend(GPU_BLEND_NONE);
 cut_off = 0;
 x1 = x2;
   }
diff --git a/source/blender/windowmanager/intern/wm_jobs.c 
b/source/blender/windowmanager/intern/wm_jobs.c
index 6494c337c10..2604105896d 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -230,7 +230,7 @@ bool WM_jobs_test(const wmWindowManager *wm, const void 
*owner, int job_type)
   LISTBASE_FOREACH (wmJob *, wm_job, >jobs) {
 if (wm_job->owner == owner) {
   if (ELEM(job_type, WM_JOB_TYPE_ANY, wm_job->job_type)) {
-if (wm_job->running || wm_job->suspended) {
+if ((wm_job->flag & WM_JOB_PROGRESS) && (wm_job->running || 
wm_job->suspended)) {
   return true;
 }
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [faf1210c0b1] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-13 Thread Aditya Y Jeppu
Commit: faf1210c0b14b35a391c51204ffa351291e18398
Author: Aditya Y Jeppu
Date:   Thu Aug 12 17:39:57 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBfaf1210c0b14b35a391c51204ffa351291e18398

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [15f33b0439f] soc-2021-vse-strip-thumbnails: Add toggle button in overlay menu for thumbnail drawing toggle

2021-08-09 Thread Aditya Y Jeppu
Commit: 15f33b0439f28a0b4ebb3b36bce55a1a7cd348df
Author: Aditya Y Jeppu
Date:   Tue Aug 10 00:06:49 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB15f33b0439f28a0b4ebb3b36bce55a1a7cd348df

Add toggle button in overlay menu for thumbnail drawing toggle

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 20fb39e8c1f..6887d3ef8a4 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -254,7 +254,8 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
 layout.prop(st, "show_strip_offset", text="Offsets")
 layout.prop(st, "show_fcurves", text="F-Curves")
 layout.prop(st, "show_grid", text="Grid")
-
+layout.prop(st, "show_thumbnails", text="Thumbnails")
+
 layout.separator()
 
 layout.prop_menu_enum(st, "waveform_display_type")
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 82c577d11a0..ac5696b7ef0 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -157,7 +157,7 @@ static void blo_update_defaults_screen(bScreen *screen,
   SpaceSeq *seq = area->spacedata.first;
   seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | 
SEQ_SHOW_STRIP_OVERLAY |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | 
SEQ_SHOW_STRIP_DURATION |
-   SEQ_SHOW_GRID;
+   SEQ_SHOW_GRID | SEQ_SHOW_THUMBNAILS;
 
   seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
   seq->flag |= SEQ_USE_PROXIES;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0ff02e61d1d..a1818a44de6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1497,7 +1497,8 @@ static void draw_seq_strip(const bContext *C,
 drawmeta_contents(scene, seq, x1, y1, x2, y2);
   }
 
-  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
+  if ((sseq->flag & SEQ_SHOW_THUMBNAILS) && seq->type == SEQ_TYPE_MOVIE ||
+  seq->type == SEQ_TYPE_IMAGE) {
 draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
   }
 
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c 
b/source/blender/editors/space_sequencer/space_sequencer.c
index 9e9b578e608..94895ac1954 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -100,7 +100,9 @@ static SpaceLink *sequencer_create(const ScrArea 
*UNUSED(area), const Scene *sce
   sseq->mainb = SEQ_DRAW_IMG_IMBUF;
   sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | 
SEQ_SHOW_FCURVES |
SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
-   SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID;
+   SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID 
|
+   SEQ_SHOW_THUMBNAILS;
+
   struct rctf temp = {0, 0, 0, 0};
   sseq->check_view_area = temp;
   /* Tool header. */
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index da71e145f8f..76965a4eecd 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -659,6 +659,7 @@ typedef enum eSpaceSeq_Flag {
   SEQ_SHOW_STRIP_DURATION = (1 << 16),
   SEQ_USE_PROXIES = (1 << 17),
   SEQ_SHOW_GRID = (1 << 18),
+  SEQ_SHOW_THUMBNAILS = (1<<19),
 } eSpaceSeq_Flag;
 
 /* SpaceSeq.view */
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 8c62484f229..fe43a8f878f 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -5556,6 +5556,11 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GRID);
   RNA_def_property_ui_text(prop, "Show Grid", "Show vertical grid lines");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCE

[Bf-blender-cvs] [9b08f523ec2] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-09 Thread Aditya Y Jeppu
Commit: 9b08f523ec20e58bee625b05e6ac5612886c48ab
Author: Aditya Y Jeppu
Date:   Mon Aug 9 18:11:06 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB9b08f523ec20e58bee625b05e6ac5612886c48ab

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f9367f9399d] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-09 Thread Aditya Y Jeppu
Commit: f9367f9399da24a741ff37c468bd30030874ee8d
Author: Aditya Y Jeppu
Date:   Fri Aug 6 16:02:14 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf9367f9399da24a741ff37c468bd30030874ee8d

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


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

2021-08-04 Thread Aditya Y Jeppu
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])
@@ -,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(_iter, tj->seqs);
-  while (!BLI_ghashIterator_done(_iter)) {
+  while (!BLI_ghashIterator_done(_iter) & !*stop) {
 seq_orig = BLI_ghashIterator_getKey(_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, _frame, 
tj->view_area);
   SEQ_render_thumbnails(
-  >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area);
+  >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area, stop);
 }
 BLI_ghashIterator_step(_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, >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,
  

[Bf-blender-cvs] [68e5a340b50] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-04 Thread Aditya Y Jeppu
Commit: 68e5a340b50ad4bf21df0c822b4dfe7e28c3602e
Author: Aditya Y Jeppu
Date:   Tue Aug 3 16:30:09 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB68e5a340b50ad4bf21df0c822b4dfe7e28c3602e

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [58677609ee3] soc-2021-vse-strip-thumbnails: Fix error on proxy building with thumbnail job and improve performance

2021-08-02 Thread Aditya Y Jeppu
Commit: 58677609ee3241eefa9f693bec872c0ad9c3e796
Author: Aditya Y Jeppu
Date:   Mon Aug 2 22:38:01 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB58677609ee3241eefa9f693bec872c0ad9c3e796

Fix error on proxy building with thumbnail job and improve performance

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 05d2076db27..6a0626ce460 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1208,8 +1208,13 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
 val = BLI_ghash_lookup(tj->seqs, seq_orig);
 
 if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
-  seq_thumbnail_get_frame_step(
-  seq_orig, _step, _dummy, _dummy, _dummy, 
tj->pixelx, tj->pixely);
+  seq_thumbnail_get_frame_step(val->seq_dupli,
+   _step,
+   _dummy,
+   _dummy,
+   _dummy,
+   tj->pixelx,
+   tj->pixely);
   seq_thumbnail_get_start_frame(seq_orig, frame_step, _frame, 
tj->view_area);
   SEQ_render_thumbnails(
   >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area);
@@ -1265,6 +1270,9 @@ static void sequencer_thumbnail_get_job(const bContext *C,
 G.is_break = false;
 WM_jobs_start(CTX_wm_manager(C), wm_job);
   }
+  else {
+WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL);
+  }
 
   ED_area_tag_redraw(area);
 }
@@ -1284,6 +1292,11 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   if (v2d->cur.xmax != sseq->check_view_area.xmax || v2d->cur.ymax != 
sseq->check_view_area.ymax ||
   leftover) {
 
+if (v2d->cur.xmax != sseq->check_view_area.xmax ||
+v2d->cur.ymax != sseq->check_view_area.ymax) {
+  WM_jobs_stop(CTX_wm_manager(C), NULL, thumbnail_startjob);
+}
+
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
   if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL &&
   check_seq_need_thumbnails(seq, >cur)) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4243f7fb7b9] soc-2021-vse-strip-thumbnails: Fix crash on adding new strip

2021-08-02 Thread Aditya Y Jeppu
Commit: 4243f7fb7b9bfec6ca2a125bde14aa196774766f
Author: Aditya Y Jeppu
Date:   Mon Aug 2 21:30:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB4243f7fb7b9bfec6ca2a125bde14aa196774766f

Fix crash on adding new strip

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 57b683cefc7..05d2076db27 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1286,15 +1286,17 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
   if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL &&
-  check_seq_need_thumbnails(seq, v2d)) {
+  check_seq_need_thumbnails(seq, >cur)) {
 ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail 
Hash Values");
 val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
 val->scene = scene;
 BLI_ghash_insert(thumb_data_hash, seq, val);
   }
   else {
-val_need_update->seq_dupli->start = seq->start;
-val_need_update->seq_dupli->startdisp = seq->startdisp;
+if (val_need_update != NULL) {
+  val_need_update->seq_dupli->start = seq->start;
+  val_need_update->seq_dupli->startdisp = seq->startdisp;
+}
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e6c83f4cc0b] soc-2021-vse-strip-thumbnails: Change conditions when to start caching.

2021-08-02 Thread Aditya Y Jeppu
Commit: e6c83f4cc0b3fc48152f684a4f984e00e3a888c6
Author: Aditya Y Jeppu
Date:   Mon Aug 2 00:02:44 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBe6c83f4cc0b3fc48152f684a4f984e00e3a888c6

Change conditions when to start caching.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0d5643f1d0d..57b683cefc7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1136,6 +1136,9 @@ static bool check_seq_need_thumbnails(Sequence *seq, rctf 
*view_area)
   else if (seq->machine > view_area->ymax) {
 return false;
   }
+  if (seq->type != SEQ_TYPE_MOVIE && seq->type != SEQ_TYPE_IMAGE) {
+return false;
+  }
   return true;
 }
 
@@ -1196,6 +1199,8 @@ 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(_iter, tj->seqs);
   while (!BLI_ghashIterator_done(_iter)) {
@@ -1211,7 +1216,7 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
 }
 BLI_ghashIterator_step(_iter);
   }
-  UNUSED_VARS(stop, do_update, progress);
+  UNUSED_VARS(stop, progress);
 }
 
 static void sequencer_thumbnail_get_job(const bContext *C,
@@ -1261,7 +1266,7 @@ static void sequencer_thumbnail_get_job(const bContext *C,
 WM_jobs_start(CTX_wm_manager(C), wm_job);
   }
 
-  // ED_area_tag_redraw(area);
+  ED_area_tag_redraw(area);
 }
 
 static void thumbnail_call_for_job(const bContext *C, Editing *ed, View2D 
*v2d, bool leftover)
@@ -1280,7 +1285,8 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   leftover) {
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
-  if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL) {
+  if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL &&
+  check_seq_need_thumbnails(seq, v2d)) {
 ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail 
Hash Values");
 val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
 val->scene = scene;
@@ -1301,8 +1307,8 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   }
 }
 
-/* TODO(AYJ) : Add operator to choose whether thumbnails required by user or 
not in overlay menu
- * Decrease Opacity of images when overlay over another strip
+/* TODO(AYJ) : 1) Add operator to choose whether thumbnails required by user 
or not in overlay menu
+ * 2) Decrease Opacity of images when overlay over another strip
  */
 
 static void draw_seq_strip_thumbnail(View2D *v2d,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a5b4f928fe2] soc-2021-vse-strip-thumbnails: Bug fixes - start frame value and IMB_crop assert failures

2021-07-31 Thread Aditya Y Jeppu
Commit: a5b4f928fe2ae3e7a3ef22ff15beaafb5061f38b
Author: Aditya Y Jeppu
Date:   Sun Aug 1 00:11:14 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa5b4f928fe2ae3e7a3ef22ff15beaafb5061f38b

Bug fixes - start frame value and IMB_crop assert failures

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
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 c8b4926f234..0d5643f1d0d 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1203,14 +1203,9 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
 val = BLI_ghash_lookup(tj->seqs, seq_orig);
 
 if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
-  seq_thumbnail_get_frame_step(val->seq_dupli,
-   _step,
-   _dummy,
-   _dummy,
-   _dummy,
-   tj->pixelx,
-   tj->pixely);
-  seq_thumbnail_get_start_frame(val->seq_dupli, frame_step, _frame, 
tj->view_area);
+  seq_thumbnail_get_frame_step(
+  seq_orig, _step, _dummy, _dummy, _dummy, 
tj->pixelx, tj->pixely);
+  seq_thumbnail_get_start_frame(seq_orig, frame_step, _frame, 
tj->view_area);
   SEQ_render_thumbnails(
   >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area);
 }
@@ -1266,7 +1261,7 @@ static void sequencer_thumbnail_get_job(const bContext *C,
 WM_jobs_start(CTX_wm_manager(C), wm_job);
   }
 
-  ED_area_tag_redraw(area);
+  // ED_area_tag_redraw(area);
 }
 
 static void thumbnail_call_for_job(const bContext *C, Editing *ed, View2D 
*v2d, bool leftover)
@@ -1279,18 +1274,22 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   /* Set the data for thumbnail caching job */
   if (thumb_data_hash == NULL)
 thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
-
+  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 ||
   leftover) {
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
-  if (BLI_ghash_lookup(thumb_data_hash, seq) == NULL) {
+  if ((val_need_update = BLI_ghash_lookup(thumb_data_hash, seq)) == NULL) {
 ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail 
Hash Values");
 val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
 val->scene = scene;
 BLI_ghash_insert(thumb_data_hash, seq, val);
   }
+  else {
+val_need_update->seq_dupli->start = seq->start;
+val_need_update->seq_dupli->startdisp = seq->startdisp;
+  }
 }
 
 SeqRenderData context = {0};
@@ -1302,7 +1301,10 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
   }
 }
 
-// TODO(AYJ) : Add operator to choose whether thumbnails required by user or 
not in overlay menu
+/* TODO(AYJ) : Add operator to choose whether thumbnails required by user or 
not in overlay menu
+ * Decrease Opacity of images when overlay over another strip
+ */
+
 static void draw_seq_strip_thumbnail(View2D *v2d,
  const bContext *C,
  SpaceSeq *sseq,
@@ -1397,7 +1399,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 else {
   thumbnail_call_for_job(C, scene->ed, v2d, true);
-  break;
 }
 
 cut_off = 0;
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 7d9e17a9e1b..01e8293a2c6 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2083,13 +2083,13 @@ ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
   /* Do clipping */
   if (clipped && ibuf != NULL) {
 temp = IMB_dupImBuf(ibuf);
-if (crop->xmin < 0 && crop->ymin < 0) {
+if (crop->xmin < 0 || crop->ymin < 0) {
   crop->xmin = 0;
   crop->ymin = 0;
 }
-if (crop->xmax > ibuf->x && crop->ymax > ibuf->y) {
-  crop->xmax = ibuf->x;
-  crop->ymax = ibuf->y;
+if (crop->xmax >= ibuf->x || crop->ymax >= ibuf->y) {
+  crop->xmax = ibuf->x - 1;
+  crop->ymax = ibuf->y - 1;
 }
  

[Bf-blender-cvs] [fea8bcc25c9] soc-2021-vse-strip-thumbnails: Testing global hash table to resuse duplciated seq

2021-07-31 Thread Aditya Y Jeppu
Commit: fea8bcc25c9ca4157aa0ce0816143e1586169623
Author: Aditya Y Jeppu
Date:   Sat Jul 31 21:38:08 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBfea8bcc25c9ca4157aa0ce0816143e1586169623

Testing global hash table to resuse duplciated seq

Should be replaced with storing hash in editing->runtime

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
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 8628cf0b181..c8b4926f234 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -103,6 +103,7 @@
 #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])
@@ -1110,7 +,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);
 }
@@ -1257,7 +1258,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)) {
@@ -1276,18 +1277,20 @@ 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 */
-  GHash *thumb_data_hash;
+  if (thumb_data_hash == NULL)
+thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
 
   // 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 ||
   leftover) {
-thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
-  ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail Hash 
Values");
-  val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
-  val->scene = scene;
-  BLI_ghash_insert(thumb_data_hash, seq, val);
+  if (BLI_ghash_lookup(thumb_data_hash, seq) == NULL) {
+ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail 
Hash Values");
+val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
+val->scene = scene;
+BLI_ghash_insert(thumb_data_hash, seq, val);
+  }
 }
 
 SeqRenderData context = {0};
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 6fe04456f2d..7d9e17a9e1b 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2087,6 +2087,10 @@ ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
   crop->xmin = 0;
   crop->ymin = 0;
 }
+if (crop->xmax > ibuf->x && crop->ymax > ibuf->y) {
+  crop->xmax = ibuf->x;
+  crop->ymax = ibuf->y;
+}
 IMB_rect_crop(temp, crop);
 if (temp != NULL) {
   IMB_freeImBuf(ibuf);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [57c79e07ce0] soc-2021-vse-strip-thumbnails: Fix conflicts in space_sequencer.c

2021-07-31 Thread Aditya Y Jeppu
Commit: 57c79e07ce063b7256091a7590bf33bb2488f756
Author: Aditya Y Jeppu
Date:   Fri Jul 30 19:49:29 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB57c79e07ce063b7256091a7590bf33bb2488f756

Fix conflicts in space_sequencer.c

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_space_types.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 372c7a24336..8628cf0b181 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1256,12 +1256,10 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
 WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
   }
   else {
+/* Free the hash input */
 BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
-// Workaround for now
   }
 
-  // TODO(AYJ) : add the new data to the existing thread if new information 
has come in (calls this
-  // function twice)
   if (!WM_jobs_is_running(wm_job)) {
 G.is_break = false;
 WM_jobs_start(CTX_wm_manager(C), wm_job);
@@ -1278,11 +1276,11 @@ 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 */
-  static rctf check_view = {0, 0, 0, 0};
   GHash *thumb_data_hash;
 
   // leftover is set to true if missing image in strip. false when normal call 
to all strips done
-  if (!BLI_rctf_compare(_view, >cur, 0.1) || leftover) {
+  if (v2d->cur.xmax != sseq->check_view_area.xmax || v2d->cur.ymax != 
sseq->check_view_area.ymax ||
+  leftover) {
 thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
@@ -1297,7 +1295,7 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
 context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
 context.use_proxies = false;
 sequencer_thumbnail_get_job(C, v2d, context, thumb_data_hash);
-check_view = v2d->cur;
+sseq->check_view_area = v2d->cur;
   }
 }
 
@@ -2319,8 +2317,6 @@ static void draw_seq_backdrop(View2D *v2d)
 
 static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
 {
-  struct Main *bmain = CTX_data_main(C);
-  struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
   Scene *scene = CTX_data_scene(C);
   View2D *v2d = >v2d;
   SpaceSeq *sseq = CTX_wm_space_seq(C);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c 
b/source/blender/editors/space_sequencer/space_sequencer.c
index 6de95f0995a..c6e0afc997a 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -101,7 +101,8 @@ static SpaceLink *sequencer_create(const ScrArea 
*UNUSED(area), const Scene *sce
   sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | 
SEQ_SHOW_FCURVES |
SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID;
-
+  struct rctf temp = {0, 0, 0, 0};
+  sseq->check_view_area = temp;
   /* Tool header. */
   region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
 
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index 7290647dbc6..e41cd4d9e00 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -616,6 +616,10 @@ typedef struct SpaceSeq {
   /** Multiview current eye - for internal use. */
   char multiview_eye;
   char _pad2[7];
+
+  /** Required for Thumbnail caching job call condition */ 
+  struct rctf check_view_area;
+
 } SpaceSeq;
 
 /* SpaceSeq.mainb */
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index b6e17da51b3..6fe04456f2d 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2109,8 +2109,8 @@ void SEQ_render_thumbnails(SeqRenderData *context,
   SeqRenderState state;
   seq_render_state_init();
 
-  start_frame = start_frame - 3 * frame_step;
-  float upper_limit = view_area->xmax + 3 * frame_step;
+  start_frame = start_frame - 5 * frame_step;
+  float upper_limit = view_area->xmax + 5 * frame_step;
   while (start_frame < upper_limit) {
 ibuf = seq_cache_get(context, seq_orig, roundf(start_frame), 
SEQ_CACHE_STORE_THUMBNAIL);
 if (ibuf) {

___

[Bf-blender-cvs] [f96490446f4] soc-2021-vse-strip-thumbnails: Revert "Remove static variable usage. Increase extra images cached"

2021-07-31 Thread Aditya Y Jeppu
Commit: f96490446f4b7ae2e4684e607342c3295a9e5d3e
Author: Aditya Y Jeppu
Date:   Fri Jul 30 19:28:43 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf96490446f4b7ae2e4684e607342c3295a9e5d3e

Revert "Remove static variable usage. Increase extra images cached"

This reverts commit 72550b8dc7b46d0d0ed7d3651eba8ae8f4c0c710.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_space_types.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 092fdd8ad92..9665d424da7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1253,10 +1253,12 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
 WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
   }
   else {
-/* Free the hash input */
 BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
+// Workaround for now
   }
 
+  // TODO(AYJ) : add the new data to the existing thread if new information 
has come in (calls this
+  // function twice)
   if (!WM_jobs_is_running(wm_job)) {
 G.is_break = false;
 WM_jobs_start(CTX_wm_manager(C), wm_job);
@@ -1273,11 +1275,11 @@ 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 */
+  static rctf check_view = {0, 0, 0, 0};
   GHash *thumb_data_hash;
 
   // 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 ||
-  leftover) {
+  if (!BLI_rctf_compare(_view, >cur, 0.1) || leftover) {
 thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
@@ -1292,7 +1294,7 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
 context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
 context.use_proxies = false;
 sequencer_thumbnail_get_job(C, v2d, context, thumb_data_hash);
-sseq->check_view_area = v2d->cur;
+check_view = v2d->cur;
   }
 }
 
@@ -2314,6 +2316,8 @@ static void draw_seq_backdrop(View2D *v2d)
 
 static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
 {
+  struct Main *bmain = CTX_data_main(C);
+  struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
   Scene *scene = CTX_data_scene(C);
   View2D *v2d = >v2d;
   SpaceSeq *sseq = CTX_wm_space_seq(C);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c 
b/source/blender/editors/space_sequencer/space_sequencer.c
index 6eda75e4bb3..cf26d1e3243 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -101,8 +101,7 @@ static SpaceLink *sequencer_create(const ScrArea 
*UNUSED(area), const Scene *sce
   sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | 
SEQ_SHOW_FCURVES |
SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION;
-  struct rctf temp = {0, 0, 0, 0};
-  sseq->check_view_area = temp;
+
   /* Tool header. */
   region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
 
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index 8d030e80ba1..04c9eab33f1 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -616,10 +616,6 @@ typedef struct SpaceSeq {
   /** Multiview current eye - for internal use. */
   char multiview_eye;
   char _pad2[7];
-
-  /** Required for Thumbnail caching job call condition */ 
-  struct rctf check_view_area;
-
 } SpaceSeq;
 
 /* SpaceSeq.mainb */
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 6fe04456f2d..b6e17da51b3 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2109,8 +2109,8 @@ void SEQ_render_thumbnails(SeqRenderData *context,
   SeqRenderState state;
   seq_render_state_init();
 
-  start_frame = start_frame - 5 * frame_step;
-  float upper_limit = view_area->xmax + 5 * frame_step;
+  start_frame = start_frame - 3 * frame_step;
+  float upper_limit = view_area->xmax + 3 * frame_step;
   while (start_frame < upper_limit) {
 ibuf = seq_cache_get(cont

[Bf-blender-cvs] [433de045b7c] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-31 Thread Aditya Y Jeppu
Commit: 433de045b7cde951dfcbf94f6bdb27f7c83d6245
Author: Aditya Y Jeppu
Date:   Fri Jul 30 19:29:04 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB433de045b7cde951dfcbf94f6bdb27f7c83d6245

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [72550b8dc7b] soc-2021-vse-strip-thumbnails: Remove static variable usage. Increase extra images cached

2021-07-27 Thread Aditya Y Jeppu
Commit: 72550b8dc7b46d0d0ed7d3651eba8ae8f4c0c710
Author: Aditya Y Jeppu
Date:   Tue Jul 27 23:45:09 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB72550b8dc7b46d0d0ed7d3651eba8ae8f4c0c710

Remove static variable usage. Increase extra images cached

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/makesdna/DNA_space_types.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 9665d424da7..092fdd8ad92 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1253,12 +1253,10 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
 WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
   }
   else {
+/* Free the hash input */
 BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
-// Workaround for now
   }
 
-  // TODO(AYJ) : add the new data to the existing thread if new information 
has come in (calls this
-  // function twice)
   if (!WM_jobs_is_running(wm_job)) {
 G.is_break = false;
 WM_jobs_start(CTX_wm_manager(C), wm_job);
@@ -1275,11 +1273,11 @@ 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 */
-  static rctf check_view = {0, 0, 0, 0};
   GHash *thumb_data_hash;
 
   // leftover is set to true if missing image in strip. false when normal call 
to all strips done
-  if (!BLI_rctf_compare(_view, >cur, 0.1) || leftover) {
+  if (v2d->cur.xmax != sseq->check_view_area.xmax || v2d->cur.ymax != 
sseq->check_view_area.ymax ||
+  leftover) {
 thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
 
 LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
@@ -1294,7 +1292,7 @@ static void thumbnail_call_for_job(const bContext *C, 
Editing *ed, View2D *v2d,
 context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
 context.use_proxies = false;
 sequencer_thumbnail_get_job(C, v2d, context, thumb_data_hash);
-check_view = v2d->cur;
+sseq->check_view_area = v2d->cur;
   }
 }
 
@@ -2316,8 +2314,6 @@ static void draw_seq_backdrop(View2D *v2d)
 
 static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
 {
-  struct Main *bmain = CTX_data_main(C);
-  struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
   Scene *scene = CTX_data_scene(C);
   View2D *v2d = >v2d;
   SpaceSeq *sseq = CTX_wm_space_seq(C);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c 
b/source/blender/editors/space_sequencer/space_sequencer.c
index cf26d1e3243..6eda75e4bb3 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -101,7 +101,8 @@ static SpaceLink *sequencer_create(const ScrArea 
*UNUSED(area), const Scene *sce
   sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | 
SEQ_SHOW_FCURVES |
SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION;
-
+  struct rctf temp = {0, 0, 0, 0};
+  sseq->check_view_area = temp;
   /* Tool header. */
   region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
 
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index 04c9eab33f1..8d030e80ba1 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -616,6 +616,10 @@ typedef struct SpaceSeq {
   /** Multiview current eye - for internal use. */
   char multiview_eye;
   char _pad2[7];
+
+  /** Required for Thumbnail caching job call condition */ 
+  struct rctf check_view_area;
+
 } SpaceSeq;
 
 /* SpaceSeq.mainb */
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index b6e17da51b3..6fe04456f2d 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2109,8 +2109,8 @@ void SEQ_render_thumbnails(SeqRenderData *context,
   SeqRenderState state;
   seq_render_state_init();
 
-  start_frame = start_frame - 3 * frame_step;
-  float upper_limit = view_area->xmax + 3 * frame_step;
+  start_frame = start_frame - 5 * frame_step;
+  float upper_limit = view_area->xmax + 5 * frame_step;
   while (start_frame < upper_limit) {
 ibuf = seq_cache_get(context, seq_orig, roundf(start_frame), 
SEQ_CACHE_STORE_THUMBNAIL);
 if (ibuf) {

__

[Bf-blender-cvs] [8d9f03e002a] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-27 Thread Aditya Y Jeppu
Commit: 8d9f03e002ae056d1bd246ebfe752f9cb21b1bf8
Author: Aditya Y Jeppu
Date:   Tue Jul 27 18:43:50 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB8d9f03e002ae056d1bd246ebfe752f9cb21b1bf8

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8d5e49bdea4] soc-2021-vse-strip-thumbnails: Fixed memory free error

2021-07-24 Thread Aditya Y Jeppu
Commit: 8d5e49bdea425f9e9ea705f79e7e70cea9ae1038
Author: Aditya Y Jeppu
Date:   Sun Jul 25 01:17:21 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB8d5e49bdea425f9e9ea705f79e7e70cea9ae1038

Fixed memory free error

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 3c2c8469eaf..9665d424da7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1207,9 +1207,6 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
tj->pixelx,
tj->pixely);
   seq_thumbnail_get_start_frame(val->seq_dupli, frame_step, _frame, 
tj->view_area);
-
-  printf("in job : %f %f %f \n", roundf(frame_step), frame_step, 
start_frame);
-
   SEQ_render_thumbnails(
   >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area);
 }
@@ -1255,6 +1252,10 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
 WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | 
ND_SEQUENCER);
 WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
   }
+  else {
+BLI_ghash_free(seqs, NULL, thumbnail_hash_data_free);
+// Workaround for now
+  }
 
   // TODO(AYJ) : add the new data to the existing thread if new information 
has come in (calls this
   // function twice)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [00efb3d18b3] soc-2021-vse-strip-thumbnails: Small fixes

2021-07-24 Thread Aditya Y Jeppu
Commit: 00efb3d18b36c6b6795ee22218271c1b1ece005c
Author: Aditya Y Jeppu
Date:   Sun Jul 25 00:57:07 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB00efb3d18b36c6b6795ee22218271c1b1ece005c

Small fixes

Fixed the error in calculating the value of start_frame and shifted call to
add strips for caching job to new function. Memory free errors still remain.
Much Faster and better response if thumb not cached.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index f66cf93da92..3c2c8469eaf 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1118,7 +1118,6 @@ static void thumbnail_endjob(void *data)
   WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
 }
 
-// TODO(AYJ) : Check this
 static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
 {
   if (min_ii(seq->startdisp, seq->start) > view_area->xmax) {
@@ -1130,7 +1129,7 @@ static bool check_seq_need_thumbnails(Sequence *seq, rctf 
*view_area)
   else if (seq->machine + 1.0f < view_area->ymin) {
 return false;
   }
-  else if (seq->machine > view_area->ymin) {
+  else if (seq->machine > view_area->ymax) {
 return false;
   }
   return true;
@@ -1175,15 +1174,15 @@ static void seq_thumbnail_get_start_frame(Sequence *seq,
   float *start_frame,
   rctf *view_area)
 {
-  if (seq->start >= view_area->xmin && seq->start <= view_area->xmax) {
+  if (seq->start > view_area->xmin && seq->start < view_area->xmax) {
 *start_frame = seq->start;
 return;
   }
   /* Drawing and caching both check to see if strip is in view area or not 
before calling this
* function so assuming strip/part of strip in view */
 
-  int no_invisible_thumbs = floor((view_area->xmin - seq->start)) / frame_step;
-  *start_frame = no_invisible_thumbs * frame_step;
+  int no_invisible_thumbs = (view_area->xmin - seq->start) / frame_step;
+  *start_frame = ((no_invisible_thumbs - 1) * frame_step) + seq->start;
 }
 
 static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
@@ -1198,9 +1197,8 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
   while (!BLI_ghashIterator_done(_iter)) {
 seq_orig = BLI_ghashIterator_getKey(_iter);
 val = BLI_ghash_lookup(tj->seqs, seq_orig);
-// TODO(AYJ) : Check below condition
-// if (check_seq_need_thumbnails(val->seq_dupli, tj->view_area)) {
-if (true) {
+
+if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
   seq_thumbnail_get_frame_step(val->seq_dupli,
_step,
_dummy,
@@ -1210,7 +1208,7 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
tj->pixely);
   seq_thumbnail_get_start_frame(val->seq_dupli, frame_step, _frame, 
tj->view_area);
 
-  printf("in job : %d %f %d \n", val->seq_dupli->machine, start_frame, 
100);
+  printf("in job : %f %f %f \n", roundf(frame_step), frame_step, 
start_frame);
 
   SEQ_render_thumbnails(
   >context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area);
@@ -1268,6 +1266,37 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
   ED_area_tag_redraw(area);
 }
 
+static void thumbnail_call_for_job(const bContext *C, Editing *ed, View2D 
*v2d, bool leftover)
+{
+  struct Main *bmain = CTX_data_main(C);
+  struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
+  Scene *scene = CTX_data_scene(C);
+  SpaceSeq *sseq = CTX_wm_space_seq(C);
+
+  /* Set the data for thumbnail caching job */
+  static rctf check_view = {0, 0, 0, 0};
+  GHash *thumb_data_hash;
+
+  // leftover is set to true if missing image in strip. false when normal call 
to all strips done
+  if (!BLI_rctf_compare(_view, >cur, 0.1) || leftover) {
+thumb_data_hash = BLI_ghash_ptr_new("seq_duplicates_and_origs");
+
+LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
+  ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail Hash 
Values");
+  val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 
0);
+  val->scene = scene;
+  BLI_ghash_insert(thumb_data_hash, seq, val);
+}
+
+SeqRenderData context = {0};
+SEQ_render_new_render_data(bmain, depsgraph, scene, 0, 0, 
sseq->render_size, false, );
+

[Bf-blender-cvs] [0ae42c6e747] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-24 Thread Aditya Y Jeppu
Commit: 0ae42c6e747ba263541d036c0c78f2d6bb87a749
Author: Aditya Y Jeppu
Date:   Sun Jul 25 00:56:43 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB0ae42c6e747ba263541d036c0c78f2d6bb87a749

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dd25a095acd] soc-2021-vse-strip-thumbnails: Fast Multiple Strip THumbnail caching job - V2 plus cleanup

2021-07-23 Thread Aditya Y Jeppu
Commit: dd25a095acd350c27b1d5c4d759ffeff084f2a94
Author: Aditya Y Jeppu
Date:   Sat Jul 24 00:27:54 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBdd25a095acd350c27b1d5c4d759ffeff084f2a94

Fast Multiple Strip THumbnail caching job - V2 plus cleanup

Cleaned up code. Much faster caching of thumbnails. Changed old thumbnail
cache limit checking code. Shift some operations to separate functions

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.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 7e62fe091c6..f66cf93da92 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1087,7 +1087,7 @@ typedef struct ThumbnailDrawJob {
   SeqRenderData context;
   GHash *seqs;
   Scene *scene;
-  float *cache_limits;
+  rctf *view_area;
   float pixelx;
   float pixely;
 } ThumbnailDrawJob;
@@ -1097,7 +1097,7 @@ typedef struct ThumbDataItem {
   Scene *scene;
 } ThumbDataItem;
 
-static void thumbnail_data_free(void *val)
+static void thumbnail_hash_data_free(void *val)
 {
   ThumbDataItem *item = val;
   SEQ_sequence_free(item->scene, item->seq_dupli, 0);
@@ -1107,74 +1107,83 @@ static void thumbnail_data_free(void *val)
 static void thumbnail_freejob(void *data)
 {
   ThumbnailDrawJob *tj = data;
-  BLI_ghash_free(tj->seqs, NULL, thumbnail_data_free);
-  MEM_freeN(tj->cache_limits);
+  BLI_ghash_free(tj->seqs, NULL, thumbnail_hash_data_free);
+  MEM_freeN(tj->view_area);
   MEM_freeN(tj);
 }
 
-static void seq_thumbnail_get_offset_start(Sequence *seq,
-   float *timeline_frame,
-   float *offset,
-   float pixelx,
-   float pixely,
-   float *cache_limits)
+static void thumbnail_endjob(void *data)
 {
-  float image_x = seq->strip->stripdata->orig_width;
-  float image_y = seq->strip->stripdata->orig_height;
+  ThumbnailDrawJob *tj = data;
+  WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
+}
 
-  /* Fix the dimensions to be max 256 for x or y */
-  float aspect_ratio = (float)image_x / image_y;
-  if (image_x > image_y) {
-image_x = 256;
-image_y = round_fl_to_int(image_x / aspect_ratio);
+// TODO(AYJ) : Check this
+static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
+{
+  if (min_ii(seq->startdisp, seq->start) > view_area->xmax) {
+return false;
   }
-  else {
-image_y = 256;
-image_x = round_fl_to_int(image_y * aspect_ratio);
+  else if (max_ii(seq->enddisp, seq->start + seq->len) < view_area->xmin) {
+return false;
   }
+  else if (seq->machine + 1.0f < view_area->ymin) {
+return false;
+  }
+  else if (seq->machine > view_area->ymin) {
+return false;
+  }
+  return true;
+}
 
-  /*Calculate thumb dimensions */
-  float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  aspect_ratio = ((float)image_x) / image_y;
-  float thumb_h_px = thumb_h / pixely;
-  float thumb_w = aspect_ratio * thumb_h_px * pixelx;
-
-  *offset = thumb_w;
-
-  float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : 
seq->enddisp;
-  float left_limit = seq->start;
-  float right_limit = 0;
-  /* Get the value of frame to start caching from */
-
-  while (left_limit < upper_thumb_bound) {
-right_limit = left_limit + thumb_w;
-
-/* Checks to make sure that thumbs are loaded only when in view and within 
the confines of the
- * strip */
-if (left_limit > cache_limits[3])
-  break;
-
-if (right_limit < cache_limits[2]) {
-  left_limit = right_limit;
-  continue;
-}
+static void seq_thumbnail_get_frame_step(Sequence *seq,
+ float *thumb_w,
+ float *thumb_h,
+ float *image_x,
+ float *image_y,
+ float pixelx,
+ float pixely)
+{
+  float image_width = seq->strip->stripdata->orig_width;
+  float image_height = seq->strip->stripdata->orig_height;
 
-/* ignore thumbs to the left of strip */
-if (right_limit < seq->startdisp) {
-  left_limit = right_limit;
-  continue;
-}

[Bf-blender-cvs] [11b9e782df7] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-23 Thread Aditya Y Jeppu
Commit: 11b9e782df7933adbc2d4d9ffb304e3ff745f738
Author: Aditya Y Jeppu
Date:   Sat Jul 24 00:26:51 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB11b9e782df7933adbc2d4d9ffb304e3ff745f738

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a16ac64ea75] soc-2021-vse-strip-thumbnails: Faster Multiple strip support for Thumbnail drawing - V1

2021-07-21 Thread Aditya Y Jeppu
Commit: a16ac64ea7529d6eba5045a0e3e29ccf17e9f583
Author: Aditya Y Jeppu
Date:   Thu Jul 22 00:26:41 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa16ac64ea7529d6eba5045a0e3e29ccf17e9f583

Faster Multiple strip support for Thumbnail drawing - V1

Multiple strips are added to hash and one thread can now do the rendering
work iterating over the strips. Still buggy and needs sorting out. Some
cases could lead to loop in thread.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index d445bbaa2f4..7e62fe091c6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -25,6 +25,7 @@
 #include 
 
 #include "BLI_blenlib.h"
+#include "BLI_ghash.h"
 #include "BLI_math.h"
 #include "BLI_string_utils.h"
 #include "BLI_threads.h"
@@ -1084,22 +1085,92 @@ static void draw_seq_fcurve_overlay(
 
 typedef struct ThumbnailDrawJob {
   SeqRenderData context;
-  Sequence *seq;
-  Sequence *seq_orig;
+  GHash *seqs;
   Scene *scene;
-  float x1;
-  float offset;
   float *cache_limits;
+  float pixelx;
+  float pixely;
 } ThumbnailDrawJob;
 
+typedef struct ThumbDataItem {
+  Sequence *seq_dupli;
+  Scene *scene;
+} ThumbDataItem;
+
+static void thumbnail_data_free(void *val)
+{
+  ThumbDataItem *item = val;
+  SEQ_sequence_free(item->scene, item->seq_dupli, 0);
+  MEM_freeN(val);
+}
+
 static void thumbnail_freejob(void *data)
 {
   ThumbnailDrawJob *tj = data;
-  SEQ_sequence_free(tj->scene, tj->seq, false);
+  BLI_ghash_free(tj->seqs, NULL, thumbnail_data_free);
   MEM_freeN(tj->cache_limits);
   MEM_freeN(tj);
 }
 
+static void seq_thumbnail_get_offset_start(Sequence *seq,
+   float *timeline_frame,
+   float *offset,
+   float pixelx,
+   float pixely,
+   float *cache_limits)
+{
+  float image_x = seq->strip->stripdata->orig_width;
+  float image_y = seq->strip->stripdata->orig_height;
+
+  /* Fix the dimensions to be max 256 for x or y */
+  float aspect_ratio = (float)image_x / image_y;
+  if (image_x > image_y) {
+image_x = 256;
+image_y = round_fl_to_int(image_x / aspect_ratio);
+  }
+  else {
+image_y = 256;
+image_x = round_fl_to_int(image_y * aspect_ratio);
+  }
+
+  /*Calculate thumb dimensions */
+  float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
+  aspect_ratio = ((float)image_x) / image_y;
+  float thumb_h_px = thumb_h / pixely;
+  float thumb_w = aspect_ratio * thumb_h_px * pixelx;
+
+  *offset = thumb_w;
+
+  float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : 
seq->enddisp;
+  float left_limit = seq->start;
+  float right_limit = 0;
+  /* Get the value of frame to start caching from */
+
+  while (left_limit < upper_thumb_bound) {
+right_limit = left_limit + thumb_w;
+
+/* Checks to make sure that thumbs are loaded only when in view and within 
the confines of the
+ * strip */
+if (left_limit > cache_limits[3])
+  break;
+
+if (right_limit < cache_limits[2]) {
+  left_limit = right_limit;
+  continue;
+}
+
+/* ignore thumbs to the left of strip */
+if (right_limit < seq->startdisp) {
+  left_limit = right_limit;
+  continue;
+}
+else
+  break;
+  }
+
+  *timeline_frame = left_limit;
+}
+
 static void thumbnail_endjob(void *data)
 {
   ThumbnailDrawJob *tj = data;
@@ -1109,12 +1180,29 @@ static void thumbnail_endjob(void *data)
 static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
 {
   ThumbnailDrawJob *tj = data;
-  SEQ_render_thumbnails(>context, tj->seq, tj->seq_orig, tj->x1, 
tj->offset, tj->cache_limits);
-  UNUSED_VARS(stop, do_update, progress);
+  ThumbDataItem *val;
+  Sequence *seq_orig;
+  float timeline_frame, offset;
+  GHashIterator gh_iter;
+  BLI_ghashIterator_init(_iter, tj->seqs);
+  while (!BLI_ghashIterator_done(_iter)) {
+seq_orig = BLI_ghashIterator_getKey(_iter);
+val = BLI_ghash_lookup(tj->seqs, seq_orig);
+
+seq_thumbnail_get_offset_start(
+val->seq_dupli, _frame, , tj->pixelx, tj->pixely, 
tj->cache_limits);
+printf("in job : %d %f %d \n", val->seq_dupli->machine, timeline_frame, 
100);
+SEQ_render_thumbnails(
+>context, val->seq_dupli, seq_orig, timeline_frame, offset, 
tj->cache_limits);
+BLI_ghashItera

[Bf-blender-cvs] [cfcee229d28] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-21 Thread Aditya Y Jeppu
Commit: cfcee229d2824d29e2f3ad0355309aefd3fbb517
Author: Aditya Y Jeppu
Date:   Wed Jul 21 18:49:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBcfcee229d2824d29e2f3ad0355309aefd3fbb517

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [96d8b1eb7a3] soc-2021-vse-strip-thumbnails: Fix conditions to start Thumbnail Job

2021-07-18 Thread Aditya Y Jeppu
Commit: 96d8b1eb7a3330922bda835a5defda0609e8acd6
Author: Aditya Y Jeppu
Date:   Sun Jul 18 17:00:54 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB96d8b1eb7a3330922bda835a5defda0609e8acd6

Fix conditions to start Thumbnail Job

Jobs started when view changes or images not loading. Multiple strips now
work without error but slow. In the order of strips thumbs are loaded.

===

M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 766e0b855e0..61a7a89958c 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -5794,8 +5794,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
   break;
 }
 if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
-WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE) ||
-WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) {
+WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
   /* Skip bake jobs in compositor to avoid compo header displaying
* progress bar which is not being updated (bake jobs only need
* to update NC_IMAGE context.
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 294fc52d70d..d445bbaa2f4 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1246,13 +1246,12 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
   /* TODO(AYJ) : add ability to add to a list each strip that needs thumbnail 
job done */
 
-  static rctf view_check = {0, 0, 0, 0};
-  static float strip_change_check = 0.0;
+  static rctf check_view = {0, 0, 0, 0};
+  float cache_start_frame = x1;
 
-  if (x1 != strip_change_check || BLI_rctf_compare(_check, >cur, 
0.0)) {
-sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
-strip_change_check = x1;
-view_check = v2d->cur;
+  if (!BLI_rctf_compare(_view, >cur, 0.1)) {
+sequencer_thumbnail_get_job(C, v2d, cache_start_frame, thumb_w, context, 
seq);
+check_view = v2d->cur;
   }
 
   /* Start drawing */
@@ -1291,7 +1290,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   IMB_freeImBuf(ibuf);
 }
 else {
-  sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
+  sequencer_thumbnail_get_job(C, v2d, cache_start_frame, thumb_w, context, 
seq);
   break;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b0e5a377ae3] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-18 Thread Aditya Y Jeppu
Commit: b0e5a377ae392293aec68ef770f34010bd515753
Author: Aditya Y Jeppu
Date:   Sun Jul 18 17:00:02 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBb0e5a377ae392293aec68ef770f34010bd515753

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9e6127ac252] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-17 Thread Aditya Y Jeppu
Commit: 9e6127ac252ab2e9ce6204836a990ea055a818de
Author: Aditya Y Jeppu
Date:   Sat Jul 17 15:12:56 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB9e6127ac252ab2e9ce6204836a990ea055a818de

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [58c8d7377b6] soc-2021-vse-strip-thumbnails: Fixed issue with strip slip

2021-07-14 Thread Aditya Y Jeppu
Commit: 58c8d7377b67bcef101706bd1f1c2ac0726d02a2
Author: Aditya Y Jeppu
Date:   Wed Jul 14 13:59:20 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB58c8d7377b67bcef101706bd1f1c2ac0726d02a2

Fixed issue with strip slip

===

M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/sequencer/intern/image_cache.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index 75cf8542f67..e4968aa4751 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -633,7 +633,10 @@ static bool sequencer_slip_recursively(Scene *scene, 
SlipData *data, int offset)
 }
   }
   if (changed) {
-SEQ_relations_free_imbuf(scene, >seqbase, false);
+for (int i = data->num_seq - 1; i >= 0; i--) {
+  Sequence *seq = data->seq_array[i];
+  SEQ_relations_invalidate_cache_preprocessed(scene, seq);
+}
   }
   return changed;
 }
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index e230e15e721..cfc3aa13867 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -767,7 +767,7 @@ static float 
seq_cache_timeline_frame_to_frame_index(Sequence *seq, float timeli
   /* With raw images, map timeline_frame to strip input media frame range. 
This means that static
* images or extended frame range of movies will only generate one cache 
entry. No special
* treatment in converting frame index to timeline_frame is needed. */
-  if (type == SEQ_CACHE_STORE_RAW) {
+  if (type == SEQ_CACHE_STORE_RAW || type == SEQ_CACHE_STORE_THUMBNAIL) {
 return seq_give_frame_index(seq, timeline_frame);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b72584e3dd3] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-14 Thread Aditya Y Jeppu
Commit: b72584e3dd394492855265e882ffb626523384d4
Author: Aditya Y Jeppu
Date:   Wed Jul 14 13:15:30 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBb72584e3dd394492855265e882ffb626523384d4

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [825006e2026] soc-2021-vse-strip-thumbnails: Fixed Refresh cache and strip slide error

2021-07-13 Thread Aditya Y Jeppu
Commit: 825006e202653a40bdbab89c4ccea46424132809
Author: Aditya Y Jeppu
Date:   Tue Jul 13 14:14:02 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB825006e202653a40bdbab89c4ccea46424132809

Fixed Refresh cache and strip slide error

===

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 fe58bed3b8e..daf453bb5be 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1085,6 +1085,7 @@ static void draw_seq_fcurve_overlay(
 typedef struct ThumbnailDrawJob {
   SeqRenderData context;
   Sequence *seq;
+  Sequence *seq_orig;
   Scene *scene;
   float x1;
   float offset;
@@ -1094,6 +1095,7 @@ typedef struct ThumbnailDrawJob {
 static void thumbnail_freejob(void *data)
 {
   ThumbnailDrawJob *tj = data;
+  SEQ_sequence_free(tj->scene, tj->seq, false);
   MEM_freeN(tj->cache_limits);
   MEM_freeN(tj);
 }
@@ -1107,7 +1109,7 @@ static void thumbnail_endjob(void *data)
 static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
 {
   ThumbnailDrawJob *tj = data;
-  SEQ_render_thumbnails(>context, tj->seq, tj->x1, tj->offset, 
tj->cache_limits);
+  SEQ_render_thumbnails(>context, tj->seq, tj->seq_orig, tj->x1, 
tj->offset, tj->cache_limits);
   UNUSED_VARS(stop, do_update, progress);
 }
 
@@ -1141,7 +1143,8 @@ static void sequencer_thumbnail_get_job(
 tj->offset = offset;
 tj->cache_limits = cache_limits;
 tj->context = context;
-tj->seq = seq;
+tj->seq = SEQ_sequence_dupli_recursive(tj->scene, tj->scene, NULL, seq, 0);
+tj->seq_orig = seq;
 WM_jobs_customdata_set(wm_job, tj, thumbnail_freejob);
 WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | 
ND_SEQUENCER);
 WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
@@ -1169,11 +1172,10 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 {
   struct Main *bmain = CTX_data_main(C);
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
-  ScrArea *area = CTX_wm_area(C);
   SeqRenderData context = {0};
   ImBuf *ibuf;
   bool min_size, clipped = false;
-  float aspect_ratio, image_y, image_x, cropx_min, cropx_max;
+  float image_y, image_x, cropx_min, cropx_max;
   rcti crop;
 
   /* If thumbs too small ignore */
@@ -1188,11 +1190,19 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_prefetch_render = false;
   context.is_proxy_render = false;
 
-  ibuf = SEQ_get_thumbnail(, seq, 1.0, , false, true);
-  image_x = ibuf->x;
-  image_y = ibuf->y;
+  image_x = seq->strip->stripdata->orig_width;
+  image_y = seq->strip->stripdata->orig_height;
 
-  IMB_freeImBuf(ibuf);
+  /* Fix the dimensions to be max 256 for x or y */
+  float aspect_ratio = (float)image_x / image_y;
+  if (image_x > image_y) {
+image_x = 256;
+image_y = round_fl_to_int(image_x / aspect_ratio);
+  }
+  else {
+image_y = 256;
+image_x = round_fl_to_int(image_y * aspect_ratio);
+  }
 
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
@@ -1281,8 +1291,8 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   IMB_freeImBuf(ibuf);
 }
 else {
-  strip_change_check = 0;
-  BLI_rctf_init(_check, 0, 0, 0, 0);
+  sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
+  break;
 }
 
 cut_off = 0;
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index afed2215bf3..69a3193557a 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -69,6 +69,7 @@ struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData 
*context,
   struct Sequence *seq);
 void SEQ_render_thumbnails(struct SeqRenderData *context,
struct Sequence *seq,
+   struct Sequence *seq_orig,
float timeline_frame,
float thumb_w,
float *cache_limits);
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 3f394080bcf..1807c577a24 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2029,9 +2029,7 @@ static ImBuf *seq_get_uncached_thumbnail(SeqRenderData 
*context,
   bool is_proxy_image = false;
   int rectx, recty;
 
-  BLI_mutex_lock(_render_mutex);
   ibuf = do_r

[Bf-blender-cvs] [fa003454fc5] soc-2021-vse-strip-thumbnails: Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into soc-2021-vse-strip-thumbnails

2021-07-13 Thread Aditya Y Jeppu
Commit: fa003454fc5dbe321aecb411bb7da6d4990f1edb
Author: Aditya Y Jeppu
Date:   Tue Jul 13 12:41:19 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBfa003454fc5dbe321aecb411bb7da6d4990f1edb

Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into 
soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a75b089b58e] soc-2021-vse-strip-thumbnails: Thumbnail Caching Job T89799

2021-07-13 Thread Aditya Y Jeppu
Commit: a75b089b58e91f0cf3f9199d32b463cc7923fc11
Author: Aditya Y Jeppu
Date:   Mon Jul 12 00:12:35 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa75b089b58e91f0cf3f9199d32b463cc7923fc11

Thumbnail Caching Job T89799

Differential Revision: https://developer.blender.org/D11885

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index c5ceca94aaf..fe58bed3b8e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -,12 +,8 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
   UNUSED_VARS(stop, do_update, progress);
 }
 
-static void sequencer_thumbnail_get_job(const bContext *C,
-float x1,
-float offset,
-float *cache_limits,
-SeqRenderData context,
-Sequence *seq)
+static void sequencer_thumbnail_get_job(
+const bContext *C, View2D *v2d, float x1, float offset, SeqRenderData 
context, Sequence *seq)
 {
   wmJob *wm_job;
   ThumbnailDrawJob *tj = NULL;
@@ -1132,6 +1128,14 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
   tj = WM_jobs_customdata_get(wm_job);
   if (!tj) {
 tj = MEM_callocN(sizeof(ThumbnailDrawJob), "Thumbnail draw job");
+
+/* Set the cache limits */
+float *cache_limits = MEM_callocN(4 * sizeof(float), "cache limits");
+cache_limits[0] = v2d->tot.xmin;
+cache_limits[1] = v2d->tot.xmax;
+cache_limits[2] = v2d->cur.xmin;
+cache_limits[3] = v2d->cur.xmax;
+
 tj->scene = CTX_data_scene(C);
 tj->x1 = x1;
 tj->offset = offset;
@@ -1169,7 +1173,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   SeqRenderData context = {0};
   ImBuf *ibuf;
   bool min_size, clipped = false;
-  float aspect_ratio, image_y, cropx_min, cropx_max;
+  float aspect_ratio, image_y, image_x, cropx_min, cropx_max;
   rcti crop;
 
   /* If thumbs too small ignore */
@@ -1185,17 +1189,18 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
 
   ibuf = SEQ_get_thumbnail(, seq, 1.0, , false, true);
+  image_x = ibuf->x;
   image_y = ibuf->y;
 
+  IMB_freeImBuf(ibuf);
+
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  aspect_ratio = ((float)ibuf->x) / ibuf->y;
+  aspect_ratio = ((float)image_x) / image_y;
   float thumb_h_px = thumb_h / pixely;
   float thumb_w = aspect_ratio * thumb_h_px * pixelx;
-  float zoom_x = thumb_w / ibuf->x;
-  float zoom_y = thumb_h / ibuf->y;
-
-  IMB_freeImBuf(ibuf);
+  float zoom_x = thumb_w / image_x;
+  float zoom_y = thumb_h / image_y;
 
   y2 = y1 + thumb_h - pixely;
   x1 = seq->start;
@@ -1235,15 +1240,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   static float strip_change_check = 0.0;
 
   if (x1 != strip_change_check || BLI_rctf_compare(_check, >cur, 
0.0)) {
-
-/* Set the cache limits */
-float *cache_limits = MEM_callocN(4 * sizeof(float), "cache limits");
-cache_limits[0] = v2d->tot.xmin;
-cache_limits[1] = v2d->tot.xmax;
-cache_limits[2] = v2d->cur.xmin;
-cache_limits[3] = v2d->cur.xmax;
-
-sequencer_thumbnail_get_job(C, x1, thumb_w, cache_limits, context, seq);
+sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
 strip_change_check = x1;
 view_check = v2d->cur;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3e51039ce6d] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-13 Thread Aditya Y Jeppu
Commit: 3e51039ce6d39f4db24ec20e223ce08b8ddca5e1
Author: Aditya Y Jeppu
Date:   Tue Jul 13 12:40:30 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB3e51039ce6d39f4db24ec20e223ce08b8ddca5e1

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [73a819ad20f] soc-2021-vse-strip-thumbnails: Fixed memory block free error

2021-07-11 Thread Aditya Y Jeppu
Commit: 73a819ad20f8c1b19f08c72f114a20dd2478e096
Author: Aditya Y Jeppu
Date:   Mon Jul 12 00:12:35 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB73a819ad20f8c1b19f08c72f114a20dd2478e096

Fixed memory block free error

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index c5ceca94aaf..fe58bed3b8e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -,12 +,8 @@ static void thumbnail_startjob(void *data, short *stop, 
short *do_update, float
   UNUSED_VARS(stop, do_update, progress);
 }
 
-static void sequencer_thumbnail_get_job(const bContext *C,
-float x1,
-float offset,
-float *cache_limits,
-SeqRenderData context,
-Sequence *seq)
+static void sequencer_thumbnail_get_job(
+const bContext *C, View2D *v2d, float x1, float offset, SeqRenderData 
context, Sequence *seq)
 {
   wmJob *wm_job;
   ThumbnailDrawJob *tj = NULL;
@@ -1132,6 +1128,14 @@ static void sequencer_thumbnail_get_job(const bContext 
*C,
   tj = WM_jobs_customdata_get(wm_job);
   if (!tj) {
 tj = MEM_callocN(sizeof(ThumbnailDrawJob), "Thumbnail draw job");
+
+/* Set the cache limits */
+float *cache_limits = MEM_callocN(4 * sizeof(float), "cache limits");
+cache_limits[0] = v2d->tot.xmin;
+cache_limits[1] = v2d->tot.xmax;
+cache_limits[2] = v2d->cur.xmin;
+cache_limits[3] = v2d->cur.xmax;
+
 tj->scene = CTX_data_scene(C);
 tj->x1 = x1;
 tj->offset = offset;
@@ -1169,7 +1173,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   SeqRenderData context = {0};
   ImBuf *ibuf;
   bool min_size, clipped = false;
-  float aspect_ratio, image_y, cropx_min, cropx_max;
+  float aspect_ratio, image_y, image_x, cropx_min, cropx_max;
   rcti crop;
 
   /* If thumbs too small ignore */
@@ -1185,17 +1189,18 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
 
   ibuf = SEQ_get_thumbnail(, seq, 1.0, , false, true);
+  image_x = ibuf->x;
   image_y = ibuf->y;
 
+  IMB_freeImBuf(ibuf);
+
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  aspect_ratio = ((float)ibuf->x) / ibuf->y;
+  aspect_ratio = ((float)image_x) / image_y;
   float thumb_h_px = thumb_h / pixely;
   float thumb_w = aspect_ratio * thumb_h_px * pixelx;
-  float zoom_x = thumb_w / ibuf->x;
-  float zoom_y = thumb_h / ibuf->y;
-
-  IMB_freeImBuf(ibuf);
+  float zoom_x = thumb_w / image_x;
+  float zoom_y = thumb_h / image_y;
 
   y2 = y1 + thumb_h - pixely;
   x1 = seq->start;
@@ -1235,15 +1240,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   static float strip_change_check = 0.0;
 
   if (x1 != strip_change_check || BLI_rctf_compare(_check, >cur, 
0.0)) {
-
-/* Set the cache limits */
-float *cache_limits = MEM_callocN(4 * sizeof(float), "cache limits");
-cache_limits[0] = v2d->tot.xmin;
-cache_limits[1] = v2d->tot.xmax;
-cache_limits[2] = v2d->cur.xmin;
-cache_limits[3] = v2d->cur.xmax;
-
-sequencer_thumbnail_get_job(C, x1, thumb_w, cache_limits, context, seq);
+sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
 strip_change_check = x1;
 view_check = v2d->cur;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b3862fea0b9] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-11 Thread Aditya Y Jeppu
Commit: b3862fea0b94551cf0eea48b8741b58fcd2af321
Author: Aditya Y Jeppu
Date:   Mon Jul 12 00:11:26 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBb3862fea0b94551cf0eea48b8741b58fcd2af321

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [688f5a0fe06] soc-2021-vse-strip-thumbnails: Thumbnail Job - Version 1

2021-07-10 Thread Aditya Y Jeppu
Commit: 688f5a0fe0641408ebc61d160b649625f8a2a279
Author: Aditya Y Jeppu
Date:   Sat Jul 10 20:09:46 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB688f5a0fe0641408ebc61d160b649625f8a2a279

Thumbnail Job - Version 1

The current code has been tested and three areas it breaks.
1) refreshing a bunch of times
2) strip slide
3) multiple strips.
Multiple strip support is being worked on now. Other points are bugs.

===

M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/render.c
M   source/blender/windowmanager/WM_api.h

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 9c17486aea4..abc86504746 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6634,6 +6634,11 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
   icon = ICON_SEQUENCE;
   break;
 }
+if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) {
+  handle_event = B_STOPSEQ;
+  icon = ICON_SEQUENCE;
+  break;
+}
 if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) {
   handle_event = B_STOPCLIP;
   icon = ICON_TRACKER;
@@ -6670,7 +6675,8 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
   break;
 }
 if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
-WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
+WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE) ||
+WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) {
   /* Skip bake jobs in compositor to avoid compo header displaying
* progress bar which is not being updated (bake jobs only need
* to update NC_IMAGE context.
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 5adfe0cc6e9..c5ceca94aaf 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1082,6 +1082,75 @@ static void draw_seq_fcurve_overlay(
   }
 }
 
+typedef struct ThumbnailDrawJob {
+  SeqRenderData context;
+  Sequence *seq;
+  Scene *scene;
+  float x1;
+  float offset;
+  float *cache_limits;
+} ThumbnailDrawJob;
+
+static void thumbnail_freejob(void *data)
+{
+  ThumbnailDrawJob *tj = data;
+  MEM_freeN(tj->cache_limits);
+  MEM_freeN(tj);
+}
+
+static void thumbnail_endjob(void *data)
+{
+  ThumbnailDrawJob *tj = data;
+  WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
+}
+
+static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
+{
+  ThumbnailDrawJob *tj = data;
+  SEQ_render_thumbnails(>context, tj->seq, tj->x1, tj->offset, 
tj->cache_limits);
+  UNUSED_VARS(stop, do_update, progress);
+}
+
+static void sequencer_thumbnail_get_job(const bContext *C,
+float x1,
+float offset,
+float *cache_limits,
+SeqRenderData context,
+Sequence *seq)
+{
+  wmJob *wm_job;
+  ThumbnailDrawJob *tj = NULL;
+  ScrArea *area = CTX_wm_area(C);
+  wm_job = WM_jobs_get(CTX_wm_manager(C),
+   CTX_wm_window(C),
+   CTX_data_scene(C),
+   "Draw Thumbnails",
+   WM_JOB_PROGRESS,
+   WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL);
+
+  /* Get the thumbnail job if it exists. */
+  tj = WM_jobs_customdata_get(wm_job);
+  if (!tj) {
+tj = MEM_callocN(sizeof(ThumbnailDrawJob), "Thumbnail draw job");
+tj->scene = CTX_data_scene(C);
+tj->x1 = x1;
+tj->offset = offset;
+tj->cache_limits = cache_limits;
+tj->context = context;
+tj->seq = seq;
+WM_jobs_customdata_set(wm_job, tj, thumbnail_freejob);
+WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | 
ND_SEQUENCER);
+WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
+  }
+
+  if (!WM_jobs_is_running(wm_job)) {
+G.is_break = false;
+WM_jobs_start(CTX_wm_manager(C), wm_job);
+  }
+
+  ED_area_tag_redraw(area);
+}
+
 static void draw_seq_strip_thumbnail(View2D *v2d,
  const bContext *C,
  SpaceSeq *sseq,
@@ -1096,16 +1165,14 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 {
   struct Main *bmain = CTX_data_main(C);
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);

[Bf-blender-cvs] [f28759541fc] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-10 Thread Aditya Y Jeppu
Commit: f28759541fc6009302460ecd4c0171ad4d9f4bcd
Author: Aditya Y Jeppu
Date:   Sat Jul 10 18:12:11 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf28759541fc6009302460ecd4c0171ad4d9f4bcd

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7d2f7886c73] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-08 Thread Aditya Y Jeppu
Commit: 7d2f7886c73b8f981fcc66f627c1cf95862686e5
Author: Aditya Y Jeppu
Date:   Thu Jul 8 17:59:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB7d2f7886c73b8f981fcc66f627c1cf95862686e5

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [114b9ef9cda] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-07 Thread Aditya Y Jeppu
Commit: 114b9ef9cdada88ecc158e04ab27f22a19f40953
Author: Aditya Y Jeppu
Date:   Wed Jul 7 13:50:53 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB114b9ef9cdada88ecc158e04ab27f22a19f40953

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [caf2ee76c09] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-01 Thread Aditya Y Jeppu
Commit: caf2ee76c0991652667371e9c4db9e58f3a0bb2e
Author: Aditya Y Jeppu
Date:   Thu Jul 1 17:30:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBcaf2ee76c0991652667371e9c4db9e58f3a0bb2e

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [91c4e3e2a5b] soc-2021-vse-strip-thumbnails: Changed ordering of drawing function in draw_seq_strip

2021-06-29 Thread Aditya Y Jeppu
Commit: 91c4e3e2a5b847210c4c825105e9f3997b9f307b
Author: Aditya Y Jeppu
Date:   Tue Jun 29 17:22:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB91c4e3e2a5b847210c4c825105e9f3997b9f307b

Changed ordering of drawing function in draw_seq_strip

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 9005161c71f..5c38838039c 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1260,6 +1260,10 @@ static void draw_seq_strip(const bContext *C,
 drawmeta_contents(scene, seq, x1, y1, x2, y2);
   }
 
+  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
+draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
+  }
+
   if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & 
SEQ_SHOW_FCURVES)) {
 draw_seq_fcurve_overlay(scene, v2d, seq, x1, y1, x2, y2, pixelx);
   }
@@ -1288,10 +1292,6 @@ static void draw_seq_strip(const bContext *C,
 draw_seq_invalid(x1, x2, y2, text_margin_y);
   }
 
-  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
-draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
-  }
-
   pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a28c412b466] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-29 Thread Aditya Y Jeppu
Commit: a28c412b46683b82ecb27c269055a2825b98b75e
Author: Aditya Y Jeppu
Date:   Tue Jun 29 14:15:18 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa28c412b46683b82ecb27c269055a2825b98b75e

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d07dc28e0c9] soc-2021-vse-strip-thumbnails: Added changes specified in comments - D11718

2021-06-28 Thread Aditya Y Jeppu
Commit: d07dc28e0c9171218a6aa13505f6cf7715fb4f9c
Author: Aditya Y Jeppu
Date:   Mon Jun 28 18:59:15 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBd07dc28e0c9171218a6aa13505f6cf7715fb4f9c

Added changes specified in comments - D11718

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
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 03ef414d9e6..9005161c71f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1116,7 +1116,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.use_proxies = false;
   context.is_prefetch_render = false;
   context.is_proxy_render = false;
-  context.is_thumb = true;
 
   ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, cache_limits, 
, false);
   image_y = ibuf->y;
@@ -1176,7 +1175,8 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 BLI_rcti_init(, (int)(cropx_min), (int)(cropx_max)-1, 0, 
(int)(image_y)-1);
 
 /* Get the image */
-ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), 
cache_limits, , clipped);
+ibuf = SEQ_render_thumbnail(
+, seq, round_fl_to_int(x1 + (cut_off)), cache_limits, , 
clipped);
 
 if (ibuf) {
   ED_draw_imbuf_ctx_clipping(
diff --git a/source/blender/makesdna/DNA_sequence_types.h 
b/source/blender/makesdna/DNA_sequence_types.h
index 6e77b04f65c..21cc9116fc3 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -691,22 +691,23 @@ enum {
   SEQ_CACHE_STORE_PREPROCESSED = (1 << 1),
   SEQ_CACHE_STORE_COMPOSITE = (1 << 2),
   SEQ_CACHE_STORE_FINAL_OUT = (1 << 3),
-  SEQ_CACHE_STORE_THUMBNAIL = (1 << 4),
 
   /* For lookup purposes */
-  SEQ_CACHE_ALL_TYPES = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED |  
SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT,
+  SEQ_CACHE_ALL_TYPES = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED |
+SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT,
 
-  SEQ_CACHE_OVERRIDE = (1 << 5),
+  SEQ_CACHE_OVERRIDE = (1 << 4),
 
   /* enable cache visualization overlay in timeline UI */
-  SEQ_CACHE_VIEW_ENABLE = (1 << 6),
-  SEQ_CACHE_VIEW_RAW = (1 << 7),
-  SEQ_CACHE_VIEW_PREPROCESSED = (1 << 8),
-  SEQ_CACHE_VIEW_COMPOSITE = (1 << 9),
-  SEQ_CACHE_VIEW_FINAL_OUT = (1 << 10),
-
-  SEQ_CACHE_PREFETCH_ENABLE = (1 << 11),
-  SEQ_CACHE_DISK_CACHE_ENABLE = (1 << 12),
+  SEQ_CACHE_VIEW_ENABLE = (1 << 5),
+  SEQ_CACHE_VIEW_RAW = (1 << 6),
+  SEQ_CACHE_VIEW_PREPROCESSED = (1 << 7),
+  SEQ_CACHE_VIEW_COMPOSITE = (1 << 8),
+  SEQ_CACHE_VIEW_FINAL_OUT = (1 << 9),
+
+  SEQ_CACHE_PREFETCH_ENABLE = (1 << 10),
+  SEQ_CACHE_DISK_CACHE_ENABLE = (1 << 11),
+  SEQ_CACHE_STORE_THUMBNAIL = (1 << 12),
 };
 
 #ifdef __cplusplus
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index 6860b2c15d2..96788a4f67c 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -51,7 +51,6 @@ typedef struct SeqRenderData {
   bool skip_cache;
   bool is_proxy_render;
   bool is_prefetch_render;
-  bool is_thumb;
   int view_id;
   /* ID of task for assigning temp cache entries to particular task(thread, 
etc.) */
   eSeqTaskId task_id;
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index 8d0d6a28941..e230e15e721 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -1209,7 +1209,7 @@ void seq_cache_free_temp_cache(Scene *scene, short id, 
int timeline_frame)
 SeqCacheKey *key = BLI_ghashIterator_getKey(_iter);
 BLI_ghashIterator_step(_iter);
 
-if (key->is_temp_cache && key->task_id == id && !key->context.is_thumb) {
+if (key->is_temp_cache && key->task_id == id && key->type != 
SEQ_CACHE_STORE_THUMBNAIL) {
   /* Use frame_index here to avoid freeing raw images if they are used for 
multiple frames. */
   float frame_index = seq_cache_timeline_frame_to_frame_index(
   key->seq, timeline_frame, key->type);
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index aac5debaacc..0584da25557 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -235,7 +23

[Bf-blender-cvs] [3eb694dd3d4] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-28 Thread Aditya Y Jeppu
Commit: 3eb694dd3d42ca2a400d148e76575ba1d9d23105
Author: Aditya Y Jeppu
Date:   Mon Jun 28 18:57:14 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB3eb694dd3d42ca2a400d148e76575ba1d9d23105

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [21a3dd756ab] soc-2021-vse-strip-thumbnails: Combined caching and thumbnail drawing code

2021-06-28 Thread Aditya Y Jeppu
Commit: 21a3dd756abda33746bd5ef57a3cc37cf5494009
Author: Aditya Y Jeppu
Date:   Sun Jun 27 18:39:06 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB21a3dd756abda33746bd5ef57a3cc37cf5494009

Combined caching and thumbnail drawing code

Involves modification to the image rendering, caching and drawing. The
thumbs are fixed to 256 max size, the caching is limited in number
and the overall look of the thumbnails is proper (no incorrect clipping).

Maniphest task : T89143

Differential Revision: https://developer.blender.org/D11718

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.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 30b1d68f9a2..03ef414d9e6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1099,8 +1099,11 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   SeqRenderData context = {0};
   ImBuf *ibuf;
   bool min_size, clipped = false;
-  float aspect_ratio, image_x, image_y, cropx_min, cropx_max;
-  rctf crop;
+  float aspect_ratio, image_y, cropx_min, cropx_max;
+  rcti crop;
+
+  /* Not sending v2d directly to have Drawing and Internal code separation */
+  float cache_limits[4] = {v2d->tot.xmin, v2d->tot.xmax, v2d->cur.xmin, 
v2d->cur.xmax};
 
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
@@ -1115,8 +1118,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
   context.is_thumb = true;
 
-  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, v2d, , 
clipped);
-  image_x = ibuf->x;
+  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, cache_limits, 
, false);
   image_y = ibuf->y;
 
   /*Calculate thumb dimensions */
@@ -1133,7 +1135,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   x1 = seq->start;
 
   float cut_off = 0;
-  float upper_thumb_bound = seq->endstill ? seq->enddisp - seq->endstill : 
seq->enddisp;
+  float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : 
seq->enddisp;
 
   while (x1 < upper_thumb_bound) {
 x2 = x1 + thumb_w;
@@ -1162,7 +1164,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* clip if full thumbnail cannot be displayed */
-
 if (x2 > (upper_thumb_bound)) {
   x2 = upper_thumb_bound;
   clipped = true;
@@ -1172,19 +1173,17 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
 cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
-BLI_rctf_init(, cropx_min, cropx_max, 0, image_y);
-/* Get the image */
+BLI_rcti_init(, (int)(cropx_min), (int)(cropx_max)-1, 0, 
(int)(image_y)-1);
 
-ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), v2d, 
, clipped);
+/* Get the image */
+ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), 
cache_limits, , clipped);
 
-GPU_blend(GPU_BLEND_ALPHA);
 if (ibuf) {
-  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, false, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
+  ED_draw_imbuf_ctx_clipping(
+  C, ibuf, x1 + cut_off, y1, true, x1 + cut_off, y1, x2, y2, zoom_x, 
zoom_y);
   IMB_freeImBuf(ibuf);
 }
 
-GPU_blend(GPU_BLEND_NONE);
-
 cut_off = 0;
 x1 = x2;
   }
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index 06ebbfac36d..6860b2c15d2 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -71,8 +71,8 @@ struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData 
*context,
 struct ImBuf *SEQ_render_thumbnail(SeqRenderData *context,
struct Sequence *seq,
float timeline_frame,
-   View2D *v2d,
-   rctf *crop,
+   float *cache_limits,
+   rcti *crop,
bool clipped);
 void SEQ_render_init_colorspace(struct Sequence *seq);
 void SEQ_render_new_render_data(struct Main *bmain,
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index 06c081c1ba1..8d0d6a28941 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -1339,7 +1339,7 @@ void seq_cache_cleanup_sequence(Scene *scene,
   seq_cache_unlock(scene);
 }
 
-void seq_c

[Bf-blender-cvs] [c8c42d132a2] soc-2021-vse-strip-thumbnails: Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into soc-2021-vse-strip-thumbnails

2021-06-28 Thread Aditya Y Jeppu
Commit: c8c42d132a2dafd24fd6492de7ae1f1cf2ea9451
Author: Aditya Y Jeppu
Date:   Mon Jun 28 18:55:01 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBc8c42d132a2dafd24fd6492de7ae1f1cf2ea9451

Merge branch 'soc-2021-vse-strip-thumbnails' of git.blender.org:blender into 
soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bad23a721f5] soc-2021-vse-strip-thumbnails: Thumbnail Code Cleanup

2021-06-27 Thread Aditya Y Jeppu
Commit: bad23a721f547a6bb6151b6f33e9f85ac05ce5c8
Author: Aditya Y Jeppu
Date:   Sun Jun 27 18:39:06 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBbad23a721f547a6bb6151b6f33e9f85ac05ce5c8

Thumbnail Code Cleanup

Improved from the hacky way of cropping using the same process for scaling
to thumb size to using dedicated IMB_rect_crop method. Cleaned up
unnecessary code and variables.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.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 30b1d68f9a2..03ef414d9e6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1099,8 +1099,11 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   SeqRenderData context = {0};
   ImBuf *ibuf;
   bool min_size, clipped = false;
-  float aspect_ratio, image_x, image_y, cropx_min, cropx_max;
-  rctf crop;
+  float aspect_ratio, image_y, cropx_min, cropx_max;
+  rcti crop;
+
+  /* Not sending v2d directly to have Drawing and Internal code separation */
+  float cache_limits[4] = {v2d->tot.xmin, v2d->tot.xmax, v2d->cur.xmin, 
v2d->cur.xmax};
 
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
@@ -1115,8 +1118,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
   context.is_thumb = true;
 
-  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, v2d, , 
clipped);
-  image_x = ibuf->x;
+  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, cache_limits, 
, false);
   image_y = ibuf->y;
 
   /*Calculate thumb dimensions */
@@ -1133,7 +1135,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   x1 = seq->start;
 
   float cut_off = 0;
-  float upper_thumb_bound = seq->endstill ? seq->enddisp - seq->endstill : 
seq->enddisp;
+  float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : 
seq->enddisp;
 
   while (x1 < upper_thumb_bound) {
 x2 = x1 + thumb_w;
@@ -1162,7 +1164,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* clip if full thumbnail cannot be displayed */
-
 if (x2 > (upper_thumb_bound)) {
   x2 = upper_thumb_bound;
   clipped = true;
@@ -1172,19 +1173,17 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
 cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
-BLI_rctf_init(, cropx_min, cropx_max, 0, image_y);
-/* Get the image */
+BLI_rcti_init(, (int)(cropx_min), (int)(cropx_max)-1, 0, 
(int)(image_y)-1);
 
-ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), v2d, 
, clipped);
+/* Get the image */
+ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), 
cache_limits, , clipped);
 
-GPU_blend(GPU_BLEND_ALPHA);
 if (ibuf) {
-  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, false, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
+  ED_draw_imbuf_ctx_clipping(
+  C, ibuf, x1 + cut_off, y1, true, x1 + cut_off, y1, x2, y2, zoom_x, 
zoom_y);
   IMB_freeImBuf(ibuf);
 }
 
-GPU_blend(GPU_BLEND_NONE);
-
 cut_off = 0;
 x1 = x2;
   }
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index 06ebbfac36d..6860b2c15d2 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -71,8 +71,8 @@ struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData 
*context,
 struct ImBuf *SEQ_render_thumbnail(SeqRenderData *context,
struct Sequence *seq,
float timeline_frame,
-   View2D *v2d,
-   rctf *crop,
+   float *cache_limits,
+   rcti *crop,
bool clipped);
 void SEQ_render_init_colorspace(struct Sequence *seq);
 void SEQ_render_new_render_data(struct Main *bmain,
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index 06c081c1ba1..8d0d6a28941 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -1339,7 +1339,7 @@ void seq_cache_cleanup_sequence(Scene *scene,
   seq_cache_unlock(scene);
 }
 
-void seq_cache_thumbnail_cleanup(Scene *scene, Sequence *seq, Sequence 
*seq_changed)
+void seq_cache_thumbnail_cleanup(Scene *scene, Sequence *seq_changed)
 {
   SeqC

[Bf-blender-cvs] [9f5d9c16293] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-27 Thread Aditya Y Jeppu
Commit: 9f5d9c1629328912f290cf963dbbbca60e868506
Author: Aditya Y Jeppu
Date:   Sun Jun 27 10:14:36 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB9f5d9c1629328912f290cf963dbbbca60e868506

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d2c95bd7e4d] soc-2021-vse-strip-thumbnails: Strip thumbnail drawing Fix : Thumbnails crop to exact width of strip

2021-06-26 Thread Aditya Y Jeppu
Commit: d2c95bd7e4dc59cd79513792e100a04b01a14c3a
Author: Aditya Y Jeppu
Date:   Sat Jun 26 23:51:15 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBd2c95bd7e4dc59cd79513792e100a04b01a14c3a

Strip thumbnail drawing Fix : Thumbnails crop to exact width of strip

The end thumbnails crop to the exact left and right edges of the strip.
The previous version had poor clipping of thumbnails.

===

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 f3ffa45a23f..30b1d68f9a2 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1091,7 +1091,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
  float y1,
  float x2,
  float y2,
- float handsize_clamped,
  float pixelx,
  float pixely)
 {
@@ -1099,9 +1098,9 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
   SeqRenderData context = {0};
   ImBuf *ibuf;
-  float strip_x2 = x2;
-  bool min_size;
-  float aspect_ratio;
+  bool min_size, clipped = false;
+  float aspect_ratio, image_x, image_y, cropx_min, cropx_max;
+  rctf crop;
 
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
@@ -1116,7 +1115,9 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
   context.is_thumb = true;
 
-  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, v2d);
+  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, v2d, , 
clipped);
+  image_x = ibuf->x;
+  image_y = ibuf->y;
 
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
@@ -1132,12 +1133,14 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   x1 = seq->start;
 
   float cut_off = 0;
-  float upper_thumb_bound = strip_x2;
+  float upper_thumb_bound = seq->endstill ? seq->enddisp - seq->endstill : 
seq->enddisp;
 
-  while (x1 < upper_thumb_bound - 1) {
+  while (x1 < upper_thumb_bound) {
 x2 = x1 + thumb_w;
+clipped = false;
 
-/* Checks to make sure that thumbs are loaded only when in view */
+/* Checks to make sure that thumbs are loaded only when in view and within 
the confines of the
+ * strip */
 if (x1 > v2d->cur.xmax)
   break;
 
@@ -1149,6 +1152,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 /* set the clipping bound to show the left handle moving over thumbs and 
not shift thumbs */
 if (IN_RANGE_INCL(seq->startdisp, x1, x2)) {
   cut_off = seq->startdisp - x1;
+  clipped = true;
 }
 
 /* ignore thumbs to the left of strip */
@@ -1159,20 +1163,28 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 /* clip if full thumbnail cannot be displayed */
 
-if (x2 >= (upper_thumb_bound - 1)) {
-  x2 = (upper_thumb_bound - 1);
+if (x2 > (upper_thumb_bound)) {
+  x2 = upper_thumb_bound;
+  clipped = true;
   if (x2 - x1 < 1)
 break;
 }
 
+cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
+cropx_max = ((x2 - x1) / pixelx) / (zoom_y / pixely);
+BLI_rctf_init(, cropx_min, cropx_max, 0, image_y);
 /* Get the image */
-ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), v2d);
 
+ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), v2d, 
, clipped);
+
+GPU_blend(GPU_BLEND_ALPHA);
 if (ibuf) {
-  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, true, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
+  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, false, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
   IMB_freeImBuf(ibuf);
 }
 
+GPU_blend(GPU_BLEND_NONE);
+
 cut_off = 0;
 x1 = x2;
   }
@@ -1278,8 +1290,7 @@ static void draw_seq_strip(const bContext *C,
   }
 
   if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
-draw_seq_strip_thumbnail(
-v2d, C, sseq, scene, seq, x1, y1, x2, y2, handsize_clamped, pixelx, 
pixely);
+draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
   }
 
   pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index e3346d35aa4..06ebbfac36d 100644
--- a/source/blender/sequencer/SEQ_render.h
+

[Bf-blender-cvs] [d3df9357419] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-26 Thread Aditya Y Jeppu
Commit: d3df93574194283f5652202b64fc5ae0a5e0f75c
Author: Aditya Y Jeppu
Date:   Sat Jun 26 23:50:24 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBd3df93574194283f5652202b64fc5ae0a5e0f75c

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d802bf30b48] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-26 Thread Aditya Y Jeppu
Commit: d802bf30b4886fed7c36210ffd6bfdc2f2817f5f
Author: Aditya Y Jeppu
Date:   Fri Jun 25 00:00:19 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBd802bf30b4886fed7c36210ffd6bfdc2f2817f5f

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0374114aca6] soc-2021-vse-strip-thumbnails: Cache limit : Set a limit of 1000 thumbs that can be cached giving around 160MB of memory for thumbs. Once the limit is reached, all cache

2021-06-24 Thread Aditya Y Jeppu
Commit: 0374114aca64580642819efbef7253b7c1dbfd59
Author: Aditya Y Jeppu
Date:   Thu Jun 24 23:56:16 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB0374114aca64580642819efbef7253b7c1dbfd59

Cache limit : Set a limit of 1000 thumbs that can be cached giving around
160MB of memory for thumbs. Once the limit is reached, all cached thumbs
before and after the current view x limits are removed.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.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 7baf98f64d9..d652acd02fc 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1116,7 +1116,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.is_proxy_render = false;
   context.is_thumb = true;
 
-  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp);
+  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp, v2d);
 
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
@@ -1166,7 +1166,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* Get the image */
-ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off));
+ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off), v2d);
 
 if (ibuf) {
   ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, true, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index 20472650d20..e3346d35aa4 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -70,7 +70,8 @@ struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData 
*context,
   struct Sequence *seq);
 struct ImBuf *SEQ_render_thumbnail(SeqRenderData *context,
struct Sequence *seq,
-   float timeline_frame);
+   float timeline_frame,
+   View2D *v2d);
 void SEQ_render_init_colorspace(struct Sequence *seq);
 void SEQ_render_new_render_data(struct Main *bmain,
 struct Depsgraph *depsgraph,
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index 3393b034dc0..06c081c1ba1 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -148,6 +148,7 @@ typedef struct SeqCache {
   struct BLI_mempool *items_pool;
   struct SeqCacheKey *last_key;
   SeqDiskCache *disk_cache;
+  int count;
 } SeqCache;
 
 typedef struct SeqCacheItem {
@@ -1151,6 +1152,7 @@ static void seq_cache_create(Main *bmain, Scene *scene)
 cache->hash = BLI_ghash_new(seq_cache_hashhash, seq_cache_hashcmp, 
"SeqCache hash");
 cache->last_key = NULL;
 cache->bmain = bmain;
+cache->count = 0;
 BLI_mutex_init(>iterator_mutex);
 scene->ed->cache = cache;
 
@@ -1268,6 +1270,7 @@ void SEQ_cache_cleanup(Scene *scene)
 BLI_ghash_remove(cache->hash, key, seq_cache_keyfree, seq_cache_valfree);
   }
   cache->last_key = NULL;
+  cache->count = 0;
   seq_cache_unlock(scene);
 }
 
@@ -1336,6 +1339,36 @@ void seq_cache_cleanup_sequence(Scene *scene,
   seq_cache_unlock(scene);
 }
 
+void seq_cache_thumbnail_cleanup(Scene *scene, Sequence *seq, Sequence 
*seq_changed)
+{
+  SeqCache *cache = seq_cache_get_from_scene(scene);
+  if (!cache) {
+return;
+  }
+
+  int range_start = seq_changed->startdisp;
+  int range_end = seq_changed->enddisp;
+
+  int invalidate_composite = SEQ_CACHE_STORE_THUMBNAIL;
+
+  GHashIterator gh_iter;
+  BLI_ghashIterator_init(_iter, cache->hash);
+  while (!BLI_ghashIterator_done(_iter)) {
+SeqCacheKey *key = BLI_ghashIterator_getKey(_iter);
+BLI_ghashIterator_step(_iter);
+
+if ((key->type & invalidate_composite) && key->timeline_frame >= 
range_start &&
+key->timeline_frame <= range_end) {
+  if (key->link_next || key->link_prev) {
+seq_cache_relink_keys(key->link_next, key->link_prev);
+  }
+  cache->count--;
+  BLI_ghash_remove(cache->hash, key, seq_cache_keyfree, seq_cache_valfree);
+}
+  }
+  cache->last_key = NULL;
+}
+
 struct ImBuf *seq_cache_get(const SeqRenderData *context,
 Sequence *seq,
 float timeline_frame,
@

[Bf-blender-cvs] [2696fca1a0a] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-23 Thread Aditya Y Jeppu
Commit: 2696fca1a0ae574cd3c1ed316aa0bd7cc7ee0b43
Author: Aditya Y Jeppu
Date:   Wed Jun 23 17:53:23 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB2696fca1a0ae574cd3c1ed316aa0bd7cc7ee0b43

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ebe7abb677e] soc-2021-vse-strip-thumbnails: Pushed all thumbnail rendering and caching code to new function. Cleaned up all conditions using context->is_thumb.

2021-06-22 Thread Aditya Y Jeppu
Commit: ebe7abb677e538f5e3ec9c13dfd8dcc73eb31564
Author: Aditya Y Jeppu
Date:   Tue Jun 22 23:13:18 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBebe7abb677e538f5e3ec9c13dfd8dcc73eb31564

Pushed all thumbnail rendering and caching code to new function. Cleaned up
all conditions using context->is_thumb.

===

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 ca7115104c9..7baf98f64d9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1099,51 +1099,38 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
   SeqRenderData context = {0};
   ImBuf *ibuf;
-  int rectx, recty;
-  double render_size;
   float strip_x2 = x2;
   bool min_size;
   float aspect_ratio;
 
-  /* Fix size of obtained ibuf to max 256 for any dimension keeping aspect 
ratio same. Depends upon
-   * the scene set resolution for uniformity in all strips */
-  aspect_ratio = (float)scene->r.xsch / scene->r.ysch;
-
-  if (scene->r.xsch > scene->r.ysch) {
-rectx = 256;
-recty = roundf(rectx / aspect_ratio);
-  }
-  else {
-recty = 256;
-rectx = roundf(recty * aspect_ratio);
-  }
-
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
 
   if (!min_size)
 return;
 
-  SEQ_render_new_render_data(
-  bmain, depsgraph, scene, rectx, recty, sseq->render_size, false, 
);
+  SEQ_render_new_render_data(bmain, depsgraph, scene, 0, 0, sseq->render_size, 
false, );
   context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
   context.use_proxies = false;
   context.is_prefetch_render = false;
   context.is_proxy_render = false;
   context.is_thumb = true;
 
+  ibuf = SEQ_render_thumbnail(, seq, seq->startdisp);
+
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  aspect_ratio = ((float)rectx) / recty;
+  aspect_ratio = ((float)ibuf->x) / ibuf->y;
   float thumb_h_px = thumb_h / pixely;
   float thumb_w = aspect_ratio * thumb_h_px * pixelx;
-  float zoom_x = thumb_w / rectx;
-  float zoom_y = thumb_h / recty;
+  float zoom_x = thumb_w / ibuf->x;
+  float zoom_y = thumb_h / ibuf->y;
+
+  IMB_freeImBuf(ibuf);
 
   y2 = y1 + thumb_h - pixely;
   x1 = seq->start;
 
-  int frame_factor = 0;
   float cut_off = 0;
   float upper_thumb_bound = strip_x2;
 
@@ -1156,7 +1143,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
 if (x2 < v2d->cur.xmin) {
   x1 = x2;
-  frame_factor++;
   continue;
 }
 
@@ -1180,7 +1166,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* Get the image */
-ibuf = SEQ_render_give_ibuf_direct(, x1 + (int)(cut_off), seq);
+ibuf = SEQ_render_thumbnail(, seq, x1 + (int)(cut_off));
 
 if (ibuf) {
   ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, true, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
@@ -1188,7 +1174,6 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 cut_off = 0;
-frame_factor++;
 x1 = x2;
   }
 }
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index d8789eb21d0..20472650d20 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -68,6 +68,9 @@ struct ImBuf *SEQ_render_give_ibuf(const SeqRenderData 
*context,
 struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context,
   float timeline_frame,
   struct Sequence *seq);
+struct ImBuf *SEQ_render_thumbnail(SeqRenderData *context,
+   struct Sequence *seq,
+   float timeline_frame);
 void SEQ_render_init_colorspace(struct Sequence *seq);
 void SEQ_render_new_render_data(struct Main *bmain,
 struct Depsgraph *depsgraph,
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 11feea1ddb3..c4307984adb 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -469,9 +469,6 @@ static bool seq_input_have_to_preprocess(const 
SeqRenderData *context,
 return true;
   }
 
-  if (context->is_thumb)
-return true;
-
   return false;
 }
 
@@ -539,7 +536,7 @@ static void sequencer_thumbnail_transform(ImBuf *in, ImBuf 
*out, const SeqRender
   

[Bf-blender-cvs] [fbae0d75bc0] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-22 Thread Aditya Y Jeppu
Commit: fbae0d75bc0df0b71f1d84f96944f8260b221b30
Author: Aditya Y Jeppu
Date:   Tue Jun 22 15:21:15 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBfbae0d75bc0df0b71f1d84f96944f8260b221b30

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c32ddae8477] soc-2021-vse-strip-thumbnails: Cleanup : Fixed the thumbnail size to max 256 for any dimension. Removed scaling and cropping from UI - hard scale to match result dimensi

2021-06-22 Thread Aditya Y Jeppu
Commit: c32ddae847714e7199de6e3df57a60ffb6f50fd5
Author: Aditya Y Jeppu
Date:   Tue Jun 22 18:07:54 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBc32ddae847714e7199de6e3df57a60ffb6f50fd5

Cleanup : Fixed the thumbnail size to max 256 for any dimension. Removed
scaling and cropping from UI - hard scale to match result dimensions and
no crop. Removed any further preprocessing as the thumbnails should represent
original source footage. any rotation or tranform could confuse users as to
what the strip original footage was.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
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 09e40e92777..ca7115104c9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1103,21 +1103,21 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   double render_size;
   float strip_x2 = x2;
   bool min_size;
+  float aspect_ratio;
 
-  if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
-return;
-  }
+  /* Fix size of obtained ibuf to max 256 for any dimension keeping aspect 
ratio same. Depends upon
+   * the scene set resolution for uniformity in all strips */
+  aspect_ratio = (float)scene->r.xsch / scene->r.ysch;
 
-  if (sseq->render_size == SEQ_RENDER_SIZE_SCENE) {
-render_size = scene->r.size / 100.0;
+  if (scene->r.xsch > scene->r.ysch) {
+rectx = 256;
+recty = roundf(rectx / aspect_ratio);
   }
   else {
-render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
+recty = 256;
+rectx = roundf(recty * aspect_ratio);
   }
 
-  rectx = roundf(render_size * 0.25 * scene->r.xsch);
-  recty = roundf(render_size * 0.25 * scene->r.ysch);
-
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
 
@@ -1134,7 +1134,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  float aspect_ratio = ((float)rectx) / recty;
+  aspect_ratio = ((float)rectx) / recty;
   float thumb_h_px = thumb_h / pixely;
   float thumb_w = aspect_ratio * thumb_h_px * pixelx;
   float zoom_x = thumb_w / rectx;
@@ -1292,7 +1292,7 @@ static void draw_seq_strip(const bContext *C,
 draw_seq_invalid(x1, x2, y2, text_margin_y);
   }
 
-  if (seq->type == SEQ_TYPE_MOVIE) {
+  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
 draw_seq_strip_thumbnail(
 v2d, C, sseq, scene, seq, x1, y1, x2, y2, handsize_clamped, pixelx, 
pixely);
   }
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 1eee3e01bb1..11feea1ddb3 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -531,6 +531,41 @@ static void sequencer_image_crop_init(const Sequence *seq,
   BLI_rctf_init(r_crop, left, in->x - right, bottom, in->y - top);
 }
 
+static void sequencer_thumbnail_transform(ImBuf *in, ImBuf *out, const 
SeqRenderData *context)
+{
+  const Scene *scene = context->scene;
+  const float preview_scale_factor = context->preview_render_size == 
SEQ_RENDER_SIZE_SCENE ?
+ (float)scene->r.size / 100 :
+ SEQ_rendersize_to_scale_factor(
+ context->preview_render_size);
+
+  float image_scale_factor = (float)context->rectx / in->x;
+  float transform_matrix[3][3];
+
+  /* set to keep same loc,scale,rot but change scale to thumb size limit*/
+  const float scale_x = 1 * image_scale_factor;
+  const float scale_y = 1 * image_scale_factor;
+  const float image_center_offs_x = (out->x - in->x) / 2;
+  const float image_center_offs_y = (out->y - in->y) / 2;
+  const float translate_x = 0 * preview_scale_factor + image_center_offs_x;
+  const float translate_y = 0 * preview_scale_factor + image_center_offs_y;
+  const float pivot[2] = {in->x / 2, in->y / 2};
+  loc_rot_size_to_mat3(transform_matrix,
+   (const float[]){translate_x, translate_y},
+   0,
+   (const float[]){scale_x, scale_y});
+  transform_pivot_set_m3(transform_matrix, pivot);
+  invert_m3(transform_matrix);
+
+  /* no crop */
+  rctf source_crop;
+  BLI_rctf_init(_crop, 0, in->x, 0, in->y);
+
+  const eIMBInterpolationFilterMode filter = context->for_render ? 
IMB_FILTER_BILINEAR :
+   
IMB_FILTER_NEAREST;
+  IMB_transform(in, out, tra

[Bf-blender-cvs] [4b03995ce51] soc-2021-vse-strip-thumbnails: Thumbnail Cache fix : thumbs get loaded and not cleared when preview on

2021-06-20 Thread Aditya Y Jeppu
Commit: 4b03995ce51bcb6b7f81ccfb929dd997d30934ab
Author: Aditya Y Jeppu
Date:   Sun Jun 20 20:00:20 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB4b03995ce51bcb6b7f81ccfb929dd997d30934ab

Thumbnail Cache fix : thumbs get loaded and not cleared when preview on

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/intern/image_cache.c
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 61c42e228d1..09e40e92777 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1145,7 +1145,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 
   int frame_factor = 0;
   float cut_off = 0;
-  float upper_thumb_bound = strip_x2 - handsize_clamped;
+  float upper_thumb_bound = strip_x2;
 
   while (x1 < upper_thumb_bound - 1) {
 x2 = x1 + thumb_w;
@@ -1172,6 +1172,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* clip if full thumbnail cannot be displayed */
+
 if (x2 >= (upper_thumb_bound - 1)) {
   x2 = (upper_thumb_bound - 1);
   if (x2 - x1 < 1)
@@ -1179,7 +1180,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* Get the image */
-ibuf = SEQ_render_give_ibuf_direct(, x1 + cut_off, seq);
+ibuf = SEQ_render_give_ibuf_direct(, x1 + (int)(cut_off), seq);
 
 if (ibuf) {
   ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, true, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
diff --git a/source/blender/sequencer/intern/image_cache.c 
b/source/blender/sequencer/intern/image_cache.c
index ef6bec474e7..3393b034dc0 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -1207,7 +1207,7 @@ void seq_cache_free_temp_cache(Scene *scene, short id, 
int timeline_frame)
 SeqCacheKey *key = BLI_ghashIterator_getKey(_iter);
 BLI_ghashIterator_step(_iter);
 
-if (key->is_temp_cache && key->task_id == id) {
+if (key->is_temp_cache && key->task_id == id && !key->context.is_thumb) {
   /* Use frame_index here to avoid freeing raw images if they are used for 
multiple frames. */
   float frame_index = seq_cache_timeline_frame_to_frame_index(
   key->seq, timeline_frame, key->type);
@@ -1304,7 +1304,7 @@ void seq_cache_cleanup_sequence(Scene *scene,
   int invalidate_composite = invalidate_types & SEQ_CACHE_STORE_FINAL_OUT;
   int invalidate_source = invalidate_types &
   (SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED |
-   SEQ_CACHE_STORE_COMPOSITE);  // TODO(AYJ) : add 
thumbnail
+   SEQ_CACHE_STORE_THUMBNAIL | 
SEQ_CACHE_STORE_COMPOSITE);
 
   GHashIterator gh_iter;
   BLI_ghashIterator_init(_iter, cache->hash);
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 4d4fcc8677e..3ae9a7a5c5b 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -541,7 +541,6 @@ static void sequencer_preprocess_transform_crop(
  context->preview_render_size);
   const bool do_scale_to_render_size = seq_need_scale_to_render_size(seq, 
is_proxy_image);
   float image_scale_factor = do_scale_to_render_size ? 1.0f : 
preview_scale_factor;
-  // TODO(AYJ) : check is setting image_scale_factor as const is imp
   if (context->is_thumb)
 image_scale_factor = 0.25f;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df579a3b6da] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-20 Thread Aditya Y Jeppu
Commit: df579a3b6da712c6e0eb467181a65b038d86822d
Author: Aditya Y Jeppu
Date:   Sun Jun 20 20:01:29 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBdf579a3b6da712c6e0eb467181a65b038d86822d

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df171bf8bc1] soc-2021-vse-strip-thumbnails: Thumbnail Caching

2021-06-19 Thread Aditya Y Jeppu
Commit: df171bf8bc13ea8c3c1d59451d5cd9516fa349fb
Author: Aditya Y Jeppu
Date:   Sat Jun 19 22:47:00 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBdf171bf8bc13ea8c3c1d59451d5cd9516fa349fb

Thumbnail Caching

The caching code is updated to allow for separate thumbnail storage. The size
is taken as 0.25*render size as of now. flag set up to control when to store
thumbs. Image scaling done in preprocess stage using already present code for
crop and transform.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/image_cache.c
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 b64e739c289..61c42e228d1 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1115,8 +1115,8 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
   }
 
-  rectx = roundf(render_size * scene->r.xsch);
-  recty = roundf(render_size * scene->r.ysch);
+  rectx = roundf(render_size * 0.25 * scene->r.xsch);
+  recty = roundf(render_size * 0.25 * scene->r.ysch);
 
   /* if thumbs too small ignore */
   min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
@@ -1130,20 +1130,19 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   context.use_proxies = false;
   context.is_prefetch_render = false;
   context.is_proxy_render = false;
+  context.is_thumb = true;
 
   /*Calculate thumb dimensions */
   float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
-  float aspect_ratio = ((float)scene->r.xsch) / scene->r.ysch;
+  float aspect_ratio = ((float)rectx) / recty;
   float thumb_h_px = thumb_h / pixely;
   float thumb_w = aspect_ratio * thumb_h_px * pixelx;
-  float zoom_x = thumb_w / scene->r.xsch;
-  float zoom_y = thumb_h / scene->r.ysch;
+  float zoom_x = thumb_w / rectx;
+  float zoom_y = thumb_h / recty;
 
   y2 = y1 + thumb_h - pixely;
   x1 = seq->start;
 
-  // TODO(AYJ) : add x1 = x1 + handsize_clamped
-
   int frame_factor = 0;
   float cut_off = 0;
   float upper_thumb_bound = strip_x2 - handsize_clamped;
@@ -1175,7 +1174,7 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 /* clip if full thumbnail cannot be displayed */
 if (x2 >= (upper_thumb_bound - 1)) {
   x2 = (upper_thumb_bound - 1);
-  if (x2 - x1 < 4)
+  if (x2 - x1 < 1)
 break;
 }
 
diff --git a/source/blender/makesdna/DNA_sequence_types.h 
b/source/blender/makesdna/DNA_sequence_types.h
index 59b153397c1..008c9b2f249 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -691,22 +691,22 @@ enum {
   SEQ_CACHE_STORE_PREPROCESSED = (1 << 1),
   SEQ_CACHE_STORE_COMPOSITE = (1 << 2),
   SEQ_CACHE_STORE_FINAL_OUT = (1 << 3),
+  SEQ_CACHE_STORE_THUMBNAIL = (1 << 4),
 
   /* For lookup purposes */
-  SEQ_CACHE_ALL_TYPES = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED |
-SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT,
+  SEQ_CACHE_ALL_TYPES = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED |  
SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT,
 
-  SEQ_CACHE_OVERRIDE = (1 << 4),
+  SEQ_CACHE_OVERRIDE = (1 << 5),
 
   /* enable cache visualization overlay in timeline UI */
-  SEQ_CACHE_VIEW_ENABLE = (1 << 5),
-  SEQ_CACHE_VIEW_RAW = (1 << 6),
-  SEQ_CACHE_VIEW_PREPROCESSED = (1 << 7),
-  SEQ_CACHE_VIEW_COMPOSITE = (1 << 8),
-  SEQ_CACHE_VIEW_FINAL_OUT = (1 << 9),
-
-  SEQ_CACHE_PREFETCH_ENABLE = (1 << 10),
-  SEQ_CACHE_DISK_CACHE_ENABLE = (1 << 11),
+  SEQ_CACHE_VIEW_ENABLE = (1 << 6),
+  SEQ_CACHE_VIEW_RAW = (1 << 7),
+  SEQ_CACHE_VIEW_PREPROCESSED = (1 << 8),
+  SEQ_CACHE_VIEW_COMPOSITE = (1 << 9),
+  SEQ_CACHE_VIEW_FINAL_OUT = (1 << 10),
+
+  SEQ_CACHE_PREFETCH_ENABLE = (1 << 11),
+  SEQ_CACHE_DISK_CACHE_ENABLE = (1 << 12),
 };
 
 #ifdef __cplusplus
diff --git a/source/blender/sequencer/SEQ_render.h 
b/source/blender/sequencer/SEQ_render.h
index c138daf1318..d8789eb21d0 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -51,6 +51,7 @@ typedef struct SeqRenderData {
   bool skip_cache;
   bool is_proxy_render;
   bool is_prefetch_render;
+  bool is_thumb;
   int view_id;
   /* ID of task for assigning temp cache entries to particular task(thread, 
etc.) */
   eSeqTaskId task_id;
diff --git a/source/blender/sequenc

[Bf-blender-cvs] [c2b0164b6e5] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-19 Thread Aditya Y Jeppu
Commit: c2b0164b6e573ea9587913a8b6f12d52dc4f0e68
Author: Aditya Y Jeppu
Date:   Sat Jun 19 22:52:32 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBc2b0164b6e573ea9587913a8b6f12d52dc4f0e68

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [92d06984e46] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-18 Thread Aditya Y Jeppu
Commit: 92d06984e469e215791a9debef9ad82c9c808f48
Author: Aditya Y Jeppu
Date:   Fri Jun 18 17:28:52 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB92d06984e469e215791a9debef9ad82c9c808f48

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dc2dc9ffafc] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-17 Thread Aditya Y Jeppu
Commit: dc2dc9ffafc1fe96abb3df09c1701b7fad59cc41
Author: Aditya Y Jeppu
Date:   Thu Jun 17 18:05:31 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBdc2dc9ffafc1fe96abb3df09c1701b7fad59cc41

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [96c50ae2bac] soc-2021-vse-strip-thumbnails: VSE strip thumbnail drawing function

2021-06-17 Thread Aditya Y Jeppu
Commit: 96c50ae2bac91b97b333f812abb558c15da40d9f
Author: Aditya Y Jeppu
Date:   Wed Jun 16 00:18:56 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB96c50ae2bac91b97b333f812abb558c15da40d9f

VSE strip thumbnail drawing function

Thumbnail Drawing Function Improvements T89144

The previous version drew the thumbnails but didn't take into consideration
The visible range where the thumbs should be seen and tried to draw till
end of strip. This version considers only those thumbails which can be seen
and leads to large performance gain. Multiple strips can be used smoothly.
Drawing logic was change to keep same thumbs when strip slide operation was
performed.

Differential Revision: https://developer.blender.org/D11616

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index a7da8dd85ff..3633cb578d5 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1089,14 +1089,13 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
  SpaceSeq *sseq,
  Scene *scene,
  Sequence *seq,
- ARegion *region,
  float x1,
  float y1,
  float x2,
+ float y2,
  float handsize_clamped,
  float pixelx,
- float pixely,
- float y_threshold)
+ float pixely)
 {
   struct Main *bmain = CTX_data_main(C);
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -1104,8 +1103,8 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   ImBuf *ibuf;
   int rectx, recty;
   double render_size;
-  float y2, strip_x2 = x2;
-  float seq_disp_len;
+  float strip_x2 = x2;
+  bool min_size;
 
   if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
 return;
@@ -1118,12 +1117,15 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
   }
 
-  if (!(y_threshold))
-return;
-
   rectx = roundf(render_size * scene->r.xsch);
   recty = roundf(render_size * scene->r.ysch);
 
+  /* if thumbs too small ignore */
+  min_size = ((y2 - y1) / pixely) > 40 * U.dpi_fac;
+
+  if (!min_size)
+return;
+
   SEQ_render_new_render_data(
   bmain, depsgraph, scene, rectx, recty, sseq->render_size, false, 
);
   context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
@@ -1139,33 +1141,43 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   float zoom_x = thumb_w / scene->r.xsch;
   float zoom_y = thumb_h / scene->r.ysch;
 
-  y2 = y1 + thumb_h;
+  y2 = y1 + thumb_h - pixely;
   x1 = x1 + handsize_clamped;
 
-  seq_disp_len = seq->enddisp - seq->startdisp;
-  int frame_offset = thumb_w;
+  int frame_factor = 0;
 
   float upper_thumb_bound = strip_x2 - handsize_clamped;
 
   while (x1 < upper_thumb_bound - 1) {
 x2 = x1 + thumb_w;
 
+/* Checks to make sure that thumbs are loaded only when in view */
+if (x1 > v2d->cur.xmax)
+  break;
+
+if (x2 < v2d->cur.xmin) {
+  x1 = x2;
+  frame_factor++;
+  continue;
+}
+
 /* clip if full thumbnail cannot be displayed */
 if (x2 >= (upper_thumb_bound - 1)) {
   x2 = (upper_thumb_bound - 1);
-  if (x2 - x1 < 1)
+  if (x2 - x1 < 4)
 break;
 }
 
 /* Get the image */
-ibuf = SEQ_render_give_ibuf_direct(, seq->startdisp + x1 - 
handsize_clamped, seq);
+ibuf = SEQ_render_give_ibuf_direct(
+, seq->start + seq->startofs + frame_factor * roundf(thumb_w), 
seq);
 
 if (ibuf) {
-  ED_draw_imbuf_ctx_clipping(
-  C, ibuf, x1, y1 + pixely * 2, false, x1, y1 + pixely * 2, x2, y2, 
zoom_x, zoom_y);
+  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, false, x1, y1, x2, y2, 
zoom_x, zoom_y);
   IMB_freeImBuf(ibuf);
 }
 
+frame_factor++;
 x1 = x2;
   }
 }
@@ -1270,19 +1282,8 @@ static void draw_seq_strip(const bContext *C,
   }
 
   if (seq->type == SEQ_TYPE_MOVIE) {
-draw_seq_strip_thumbnail(v2d,
- C,
- sseq,
- scene,
- seq,
- region,
- x1,
- y1,
- x2,
-  

[Bf-blender-cvs] [09c28f9b162] soc-2021-vse-strip-thumbnails: VSE strip thumbnail improvements

2021-06-17 Thread Aditya Y Jeppu
Commit: 09c28f9b1624b6b13103e55c977b2af97b9fd05f
Author: Aditya Y Jeppu
Date:   Wed Jun 16 23:43:30 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB09c28f9b1624b6b13103e55c977b2af97b9fd05f

VSE strip thumbnail improvements

The left handle now slides over the thumbs when moving and updates the thumb
under the left handle to represent seq->startdisp. Strip slip offset has fixed
thumbs and they don't update images as they move but rather move along with the
strip itself. Helps to make the strip feel like it is a container for the movie
and the handle areas cut the movie to the strip size. Better UX.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 3633cb578d5..35ddb1bf364 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1142,10 +1142,12 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   float zoom_y = thumb_h / scene->r.ysch;
 
   y2 = y1 + thumb_h - pixely;
-  x1 = x1 + handsize_clamped;
+  x1 = seq->start;
 
-  int frame_factor = 0;
+  // TODO(AYJ) : add x1 = x1 + handsize_clamped
 
+  int frame_factor = 0;
+  float cut_off = 0;
   float upper_thumb_bound = strip_x2 - handsize_clamped;
 
   while (x1 < upper_thumb_bound - 1) {
@@ -1161,6 +1163,17 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
   continue;
 }
 
+/* set the clipping bound to show the left handle moving over thumbs and 
not shift thumbs */
+if (IN_RANGE_INCL(seq->startdisp, x1, x2)) {
+  cut_off = seq->startdisp - x1;
+}
+
+/* ignore thumbs to the left of strip */
+if (x2 < seq->startdisp) {
+  x1 = x2;
+  continue;
+}
+
 /* clip if full thumbnail cannot be displayed */
 if (x2 >= (upper_thumb_bound - 1)) {
   x2 = (upper_thumb_bound - 1);
@@ -1169,14 +1182,14 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 }
 
 /* Get the image */
-ibuf = SEQ_render_give_ibuf_direct(
-, seq->start + seq->startofs + frame_factor * roundf(thumb_w), 
seq);
+ibuf = SEQ_render_give_ibuf_direct(, x1 + cut_off, seq);
 
 if (ibuf) {
-  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, false, x1, y1, x2, y2, 
zoom_x, zoom_y);
+  ED_draw_imbuf_ctx_clipping(C, ibuf, x1, y1, true, x1 + cut_off, y1, x2, 
y2, zoom_x, zoom_y);
   IMB_freeImBuf(ibuf);
 }
 
+cut_off = 0;
 frame_factor++;
 x1 = x2;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e169120c81e] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-15 Thread Aditya Y Jeppu
Commit: e169120c81ed39bf4c259973f01323214673ff40
Author: Aditya Y Jeppu
Date:   Tue Jun 15 15:03:07 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBe169120c81ed39bf4c259973f01323214673ff40

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b18373ef6ac] soc-2021-vse-strip-thumbnails: VSE strip thumbnail drawing function

2021-06-13 Thread Aditya Y Jeppu
Commit: b18373ef6ac4d0c06c44a08d2092c53dcfc03753
Author: Aditya Y Jeppu
Date:   Mon Jun 14 00:38:38 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBb18373ef6ac4d0c06c44a08d2092c53dcfc03753

VSE strip thumbnail drawing function

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 5f831cbf535..a7da8dd85ff 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1084,6 +1084,92 @@ static void draw_seq_fcurve_overlay(
   }
 }
 
+static void draw_seq_strip_thumbnail(View2D *v2d,
+ const bContext *C,
+ SpaceSeq *sseq,
+ Scene *scene,
+ Sequence *seq,
+ ARegion *region,
+ float x1,
+ float y1,
+ float x2,
+ float handsize_clamped,
+ float pixelx,
+ float pixely,
+ float y_threshold)
+{
+  struct Main *bmain = CTX_data_main(C);
+  struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
+  SeqRenderData context = {0};
+  ImBuf *ibuf;
+  int rectx, recty;
+  double render_size;
+  float y2, strip_x2 = x2;
+  float seq_disp_len;
+
+  if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
+return;
+  }
+
+  if (sseq->render_size == SEQ_RENDER_SIZE_SCENE) {
+render_size = scene->r.size / 100.0;
+  }
+  else {
+render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
+  }
+
+  if (!(y_threshold))
+return;
+
+  rectx = roundf(render_size * scene->r.xsch);
+  recty = roundf(render_size * scene->r.ysch);
+
+  SEQ_render_new_render_data(
+  bmain, depsgraph, scene, rectx, recty, sseq->render_size, false, 
);
+  context.view_id = BKE_scene_multiview_view_id_get(>r, 
STEREO_LEFT_NAME);
+  context.use_proxies = false;
+  context.is_prefetch_render = false;
+  context.is_proxy_render = false;
+
+  /*Calculate thumb dimensions */
+  float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * 
pixely);
+  float aspect_ratio = ((float)scene->r.xsch) / scene->r.ysch;
+  float thumb_h_px = thumb_h / pixely;
+  float thumb_w = aspect_ratio * thumb_h_px * pixelx;
+  float zoom_x = thumb_w / scene->r.xsch;
+  float zoom_y = thumb_h / scene->r.ysch;
+
+  y2 = y1 + thumb_h;
+  x1 = x1 + handsize_clamped;
+
+  seq_disp_len = seq->enddisp - seq->startdisp;
+  int frame_offset = thumb_w;
+
+  float upper_thumb_bound = strip_x2 - handsize_clamped;
+
+  while (x1 < upper_thumb_bound - 1) {
+x2 = x1 + thumb_w;
+
+/* clip if full thumbnail cannot be displayed */
+if (x2 >= (upper_thumb_bound - 1)) {
+  x2 = (upper_thumb_bound - 1);
+  if (x2 - x1 < 1)
+break;
+}
+
+/* Get the image */
+ibuf = SEQ_render_give_ibuf_direct(, seq->startdisp + x1 - 
handsize_clamped, seq);
+
+if (ibuf) {
+  ED_draw_imbuf_ctx_clipping(
+  C, ibuf, x1, y1 + pixely * 2, false, x1, y1 + pixely * 2, x2, y2, 
zoom_x, zoom_y);
+  IMB_freeImBuf(ibuf);
+}
+
+x1 = x2;
+  }
+}
+
 /* Draw visible strips. Bounds check are already made. */
 static void draw_seq_strip(const bContext *C,
SpaceSeq *sseq,
@@ -1183,6 +1269,22 @@ static void draw_seq_strip(const bContext *C,
 draw_seq_invalid(x1, x2, y2, text_margin_y);
   }
 
+  if (seq->type == SEQ_TYPE_MOVIE) {
+draw_seq_strip_thumbnail(v2d,
+ C,
+ sseq,
+ scene,
+ seq,
+ region,
+ x1,
+ y1,
+ x2,
+ handsize_clamped,
+ pixelx,
+ pixely,
+ y_threshold);
+  }
+
   pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
@@ -1341,7 +1443,8 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain,
   }
 
   if (viewport) {
-/* Follows same logic as wm_draw_window_offscreen to make sure to restore 
the same viewport. */
+/* Follows same logic as wm_draw_window_offscreen to make sure to restore 
the same viewport.
+ */
 int view = (sseq->multiview_eye == ST