Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2019-04-29 00:13:41 +0300
committerRichard Antalik <richardantalik@gmail.com>2019-04-29 00:50:48 +0300
commit337cac760ba9d198fc45459f4274a94a87558528 (patch)
treed9f1c3cb901547ef4434c38c2a390795d0fff8f1 /source/blender/imbuf/intern/moviecache.c
parent1b65ec0a9b9be2aef7db88be3c6deaaa135ab382 (diff)
VSE: Cache rewrite
This patch implements new cache system. Aim is to give user more control over cache, so it can be maximally utilized. This is done through sequencer timeline side panel in category proxy & cache. Cached images are also visualized in timeline, controled by sequencer timeline view->cache menu Functional changes: - NOT use IMB_moviecache API - refactor names of cached image types - each scene owns 1 sequencer cache - merge preprocess cache into per-sequencer cache - cache links images rendered per frame in order as they are created - add cache content visualization tool - add RNA properties to control the cache More info can be found in design notes in blenkernel/intern/seqcache.c and in https://developer.blender.org/D4443 Reviewed By: brecht Differential Revision: https://developer.blender.org/D4443
Diffstat (limited to 'source/blender/imbuf/intern/moviecache.c')
-rw-r--r--source/blender/imbuf/intern/moviecache.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 4424e5548ca..3cb976a6d9f 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -186,58 +186,23 @@ static void IMB_moviecache_destructor(void *p)
}
}
-/* approximate size of ImBuf in memory */
-static size_t IMB_get_size_in_memory(ImBuf *ibuf)
+static size_t get_size_in_memory(ImBuf *ibuf)
{
- int a;
- size_t size = 0, channel_size = 0;
-
- /* Persistent images should have no affect on how "normal"
- * images are cached.
- *
- * This is a bit arbitrary, but would make it so only movies
- * and sequences are memory limited, keeping textures in the
- * memory in order to avoid constant file reload on viewport
- * update.
- */
+ /* Keep textures in the memory to avoid constant file reload on viewport update. */
if (ibuf->userflags & IB_PERSISTENT) {
return 0;
}
-
- size += sizeof(ImBuf);
-
- if (ibuf->rect) {
- channel_size += sizeof(char);
- }
-
- if (ibuf->rect_float) {
- channel_size += sizeof(float);
- }
-
- size += channel_size * ibuf->x * ibuf->y * ibuf->channels;
-
- if (ibuf->miptot) {
- for (a = 0; a < ibuf->miptot; a++) {
- if (ibuf->mipmap[a]) {
- size += IMB_get_size_in_memory(ibuf->mipmap[a]);
- }
- }
- }
-
- if (ibuf->tiles) {
- size += sizeof(unsigned int) * ibuf->ytiles * ibuf->xtiles;
+ else {
+ return IMB_get_size_in_memory(ibuf);
}
-
- return size;
}
-
static size_t get_item_size(void *p)
{
size_t size = sizeof(MovieCacheItem);
MovieCacheItem *item = (MovieCacheItem *)p;
if (item->ibuf) {
- size += IMB_get_size_in_memory(item->ibuf);
+ size += get_size_in_memory(item->ibuf);
}
return size;
@@ -407,7 +372,7 @@ bool IMB_moviecache_put_if_possible(MovieCache *cache, void *userkey, ImBuf *ibu
size_t mem_in_use, mem_limit, elem_size;
bool result = false;
- elem_size = IMB_get_size_in_memory(ibuf);
+ elem_size = get_size_in_memory(ibuf);
mem_limit = MEM_CacheLimiter_get_maximum();
BLI_mutex_lock(&limitor_lock);