diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-10 18:43:50 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-10 18:43:50 +0400 |
commit | 76ee9783a13ed9e1eb0d4415239ffebdab0a10b7 (patch) | |
tree | 3f58d4624596e5d20d0df12c53fab3f81ad563ad /source/blender/imbuf/IMB_moviecache.h | |
parent | a41dc719bf52f462ddabbb8cb1f8fb882f4affc9 (diff) |
Improved cache management for movie clips from tomato branch
Replace pseudo-LRU approach of determining which buffer
to remove when running out of space allowed for cache
with approach which would remove the frame which is most
far away from newly added frame.
This is still a bit tricky because it's impossible to
distinguish which frame to delete in situation of:
CCCC...CC
^
it's either user wants to extend left segment of cached
frames and buffers from right segment should be removed
or he wants to join this two segments and in that case
buffers from right segment should be removed.
Would need a bit more investigation which situation
is more common in general usecase.
Additional changes:
- Cleanup some memutil files (which are familiar to cache limiter)
- Add option to make moviecache verbose. If DEBUG_MESSAGES is
defined in moviecache.c detailed logs would be printed to the
console.
- Movie caches are now named which helps reading debug messages.
Diffstat (limited to 'source/blender/imbuf/IMB_moviecache.h')
-rw-r--r-- | source/blender/imbuf/IMB_moviecache.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h index f6927d4f31d..d1d34a01433 100644 --- a/source/blender/imbuf/IMB_moviecache.h +++ b/source/blender/imbuf/IMB_moviecache.h @@ -44,10 +44,19 @@ struct MovieCache; typedef void (*MovieCacheGetKeyDataFP) (void *userkey, int *framenr, int *proxy, int *render_flags); +typedef void *(*MovieCacheGetPriorityDataFP) (void *userkey); +typedef int (*MovieCacheGetItemPriorityFP) (void *last_userkey, void *priority_data); +typedef void (*MovieCachePriorityDeleterFP) (void *priority_data); + void IMB_moviecache_init(void); void IMB_moviecache_destruct(void); -struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp, MovieCacheGetKeyDataFP getdatafp); +struct MovieCache *IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp); +void IMB_moviecache_set_getdata_callback(struct MovieCache *cache, MovieCacheGetKeyDataFP getdatafp); +void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp, + MovieCacheGetItemPriorityFP getitempriorityfp, + MovieCachePriorityDeleterFP prioritydeleterfp); + void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf); struct ImBuf* IMB_moviecache_get(struct MovieCache *cache, void *userkey); void IMB_moviecache_free(struct MovieCache *cache); |