diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-11-05 17:51:26 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-11-05 17:55:17 +0300 |
commit | d837923a562dcc4a3c0b2531bfb5654473b1aca6 (patch) | |
tree | 009e707157886b6cc1814adb86c8f5b50f8a5fa0 /source/blender/editors/space_sequencer/sequencer_draw.c | |
parent | 8720c660094e7b08fe4ac8a1879feb2b3aac838e (diff) |
VSE: cache performance optimization
Map frame for cached raw images to strip input media frame range. This
means that static images or extended frame range of movies will only
generate one cache entry.
timeline_frame is stored in cache key as a reference - on what frame
was this entry created, so we don't have to reverse lookup frame range.
Since each media frame corresponds to one cache frame with same frame
index key, there is no need to invalidate raw cache when changing time
remapping properties like use_reverse_frames or strobe
No changes are needed for disk cache, since invalidating raw entry
assumes all data will be invalidated.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9462
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index c4fd167b0ee..c037aae0ed5 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2086,7 +2086,7 @@ static bool draw_cache_view_init_fn(void *userdata, size_t item_count) /* Called as a callback */ static bool draw_cache_view_iter_fn( - void *userdata, struct Sequence *seq, int nfra, int cache_type, float UNUSED(cost)) + void *userdata, struct Sequence *seq, int timeline_frame, int cache_type, float UNUSED(cost)) { CacheDrawData *drawdata = userdata; struct View2D *v2d = drawdata->v2d; @@ -2132,14 +2132,13 @@ static bool draw_cache_view_iter_fn( return false; } - int cfra = seq->start + nfra; float vert_pos[6][2]; - copy_v2_fl2(vert_pos[0], cfra, stripe_bot); - copy_v2_fl2(vert_pos[1], cfra, stripe_top); - copy_v2_fl2(vert_pos[2], cfra + 1, stripe_top); + copy_v2_fl2(vert_pos[0], timeline_frame, stripe_bot); + copy_v2_fl2(vert_pos[1], timeline_frame, stripe_top); + copy_v2_fl2(vert_pos[2], timeline_frame + 1, stripe_top); copy_v2_v2(vert_pos[3], vert_pos[2]); copy_v2_v2(vert_pos[4], vert_pos[0]); - copy_v2_fl2(vert_pos[5], cfra + 1, stripe_bot); + copy_v2_fl2(vert_pos[5], timeline_frame + 1, stripe_bot); for (int i = 0; i < 6; i++) { GPU_vertbuf_vert_set(vbo, *vert_count + i, vert_pos[i]); |