Blender V2.61 - r43446
|
#include <stdlib.h>
#include <memory.h>
#include "MEM_guardedalloc.h"
#include "MEM_CacheLimiterC-Api.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_mempool.h"
#include "IMB_moviecache.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
Go to the source code of this file.
Classes | |
struct | MovieCache |
struct | MovieCacheKey |
struct | MovieCacheItem |
Typedefs | |
typedef struct MovieCache | MovieCache |
typedef struct MovieCacheKey | MovieCacheKey |
typedef struct MovieCacheItem | MovieCacheItem |
Functions | |
static unsigned int | moviecache_hashhash (const void *keyv) |
static int | moviecache_hashcmp (const void *av, const void *bv) |
static void | moviecache_keyfree (void *val) |
static void | moviecache_valfree (void *val) |
static void | check_unused_keys (MovieCache *cache) |
static int | compare_int (const void *av, const void *bv) |
static void | IMB_moviecache_destructor (void *p) |
static intptr_t | IMB_get_size_in_memory (ImBuf *ibuf) |
static intptr_t | get_item_size (void *p) |
void | IMB_moviecache_init (void) |
void | IMB_moviecache_destruct (void) |
struct MovieCache * | IMB_moviecache_create (int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp, MovieCacheGetKeyDataFP getdatafp) |
void | IMB_moviecache_put (MovieCache *cache, void *userkey, ImBuf *ibuf) |
ImBuf * | IMB_moviecache_get (MovieCache *cache, void *userkey) |
void | IMB_moviecache_free (MovieCache *cache) |
void | IMB_moviecache_get_cache_segments (MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r) |
Variables | |
static MEM_CacheLimiterC * | limitor = NULL |
Definition in file moviecache.c.
typedef struct MovieCache MovieCache |
typedef struct MovieCacheItem MovieCacheItem |
typedef struct MovieCacheKey MovieCacheKey |
static void check_unused_keys | ( | MovieCache * | cache | ) | [static] |
Definition at line 112 of file moviecache.c.
References BLI_ghash_remove(), BLI_ghashIterator_free(), BLI_ghashIterator_getKey(), BLI_ghashIterator_getValue(), BLI_ghashIterator_isDone(), BLI_ghashIterator_new(), BLI_ghashIterator_step(), MovieCache::hash, MovieCacheItem::ibuf, moviecache_keyfree(), and moviecache_valfree().
Referenced by IMB_moviecache_put().
static int compare_int | ( | const void * | av, |
const void * | bv | ||
) | [static] |
Definition at line 130 of file moviecache.c.
Referenced by IMB_moviecache_get_cache_segments().
static intptr_t get_item_size | ( | void * | p | ) | [static] |
Definition at line 179 of file moviecache.c.
References MovieCacheItem::ibuf, IMB_get_size_in_memory(), and size().
Referenced by IMB_moviecache_init().
static intptr_t IMB_get_size_in_memory | ( | ImBuf * | ibuf | ) | [static] |
Definition at line 150 of file moviecache.c.
References ImBuf::channels, ImBuf::mipmap, ImBuf::miptot, ImBuf::rect, ImBuf::rect_float, size(), ImBuf::tiles, ImBuf::x, ImBuf::xtiles, ImBuf::y, and ImBuf::ytiles.
Referenced by get_item_size().
struct MovieCache* IMB_moviecache_create | ( | int | keysize, |
GHashHashFP | hashfp, | ||
GHashCmpFP | cmpfp, | ||
MovieCacheGetKeyDataFP | getdatafp | ||
) | [read] |
Definition at line 201 of file moviecache.c.
References BLI_ghash_new(), BLI_mempool_create(), MovieCache::cmpfp, FALSE, MovieCache::getdatafp, MovieCache::hash, MovieCache::hashfp, MovieCache::items_pool, MovieCache::keys_pool, MovieCache::keysize, MEM_callocN(), moviecache_hashcmp(), moviecache_hashhash(), MovieCache::proxy, and MovieCache::userkeys_pool.
Referenced by put_imbuf_cache(), seq_stripelem_cache_cleanup(), and seq_stripelem_cache_put().
void IMB_moviecache_destruct | ( | void | ) |
Definition at line 195 of file moviecache.c.
References delete_MEM_CacheLimiter(), and limitor.
Referenced by free_blender().
static void IMB_moviecache_destructor | ( | void * | p | ) | [static] |
Definition at line 137 of file moviecache.c.
References MovieCacheItem::c_handle, MovieCacheItem::ibuf, IMB_freeImBuf(), and NULL.
Referenced by IMB_moviecache_init().
void IMB_moviecache_free | ( | MovieCache * | cache | ) |
Definition at line 283 of file moviecache.c.
References BLI_ghash_free(), BLI_mempool_destroy(), MovieCache::hash, MovieCache::items_pool, MovieCache::keys_pool, MEM_freeN(), moviecache_keyfree(), moviecache_valfree(), MovieCache::points, and MovieCache::userkeys_pool.
Referenced by free_buffers(), seq_stripelem_cache_cleanup(), and seq_stripelem_cache_destruct().
ImBuf* IMB_moviecache_get | ( | MovieCache * | cache, |
void * | userkey | ||
) | [read] |
Definition at line 260 of file moviecache.c.
References BLI_ghash_lookup(), MovieCacheItem::c_handle, MovieCacheKey::cache_owner, MovieCache::curtime, MovieCache::hash, MovieCacheItem::ibuf, IMB_refImBuf(), MovieCacheItem::last_access, MEM_CacheLimiter_touch(), NULL, and MovieCacheKey::userkey.
Referenced by get_imbuf_cache(), and seq_stripelem_cache_get().
void IMB_moviecache_get_cache_segments | ( | MovieCache * | cache, |
int | proxy, | ||
int | render_flags, | ||
int * | totseg_r, | ||
int ** | points_r | ||
) |
Definition at line 298 of file moviecache.c.
References BLI_ghash_size(), BLI_ghashIterator_free(), BLI_ghashIterator_getKey(), BLI_ghashIterator_getValue(), BLI_ghashIterator_isDone(), BLI_ghashIterator_new(), BLI_ghashIterator_step(), compare_int(), MovieCache::getdatafp, MovieCache::hash, MovieCacheItem::ibuf, MEM_callocN(), MEM_freeN(), NULL, MovieCache::points, MovieCache::proxy, MovieCache::render_flags, MovieCache::totseg, and MovieCacheKey::userkey.
Referenced by BKE_movieclip_get_cache_segments().
void IMB_moviecache_init | ( | void | ) |
Definition at line 190 of file moviecache.c.
References get_item_size(), IMB_moviecache_destructor(), limitor, and new_MEM_CacheLimiter().
Referenced by IMB_moviecache_put().
void IMB_moviecache_put | ( | MovieCache * | cache, |
void * | userkey, | ||
ImBuf * | ibuf | ||
) |
Definition at line 221 of file moviecache.c.
References BLI_ghash_insert(), BLI_ghash_remove(), BLI_mempool_alloc(), MovieCacheItem::c_handle, MovieCacheItem::cache_owner, MovieCacheKey::cache_owner, check_unused_keys(), MovieCache::curtime, MovieCache::hash, MovieCacheItem::ibuf, IMB_moviecache_init(), IMB_refImBuf(), MovieCache::items_pool, MovieCache::keys_pool, MovieCache::keysize, MovieCacheItem::last_access, limitor, MEM_CacheLimiter_enforce_limits(), MEM_CacheLimiter_insert(), MEM_CacheLimiter_ref(), MEM_CacheLimiter_unref(), MEM_freeN(), moviecache_keyfree(), moviecache_valfree(), NULL, MovieCache::points, MovieCacheKey::userkey, and MovieCache::userkeys_pool.
Referenced by put_imbuf_cache(), and seq_stripelem_cache_put().
static int moviecache_hashcmp | ( | const void * | av, |
const void * | bv | ||
) | [static] |
Definition at line 85 of file moviecache.c.
References MovieCacheKey::cache_owner, MovieCache::cmpfp, and MovieCacheKey::userkey.
Referenced by IMB_moviecache_create().
static unsigned int moviecache_hashhash | ( | const void * | keyv | ) | [static] |
Definition at line 78 of file moviecache.c.
References MovieCacheKey::cache_owner, MovieCache::hashfp, and MovieCacheKey::userkey.
Referenced by IMB_moviecache_create().
static void moviecache_keyfree | ( | void * | val | ) | [static] |
Definition at line 93 of file moviecache.c.
References BLI_mempool_free(), MovieCacheKey::cache_owner, and MovieCache::keys_pool.
Referenced by check_unused_keys(), IMB_moviecache_free(), and IMB_moviecache_put().
static void moviecache_valfree | ( | void * | val | ) | [static] |
Definition at line 100 of file moviecache.c.
References BLI_mempool_free(), MovieCacheItem::c_handle, MovieCacheItem::cache_owner, MovieCacheItem::ibuf, IMB_freeImBuf(), MovieCache::items_pool, and MEM_CacheLimiter_unmanage().
Referenced by check_unused_keys(), IMB_moviecache_free(), and IMB_moviecache_put().
MEM_CacheLimiterC* limitor = NULL [static] |
Definition at line 47 of file moviecache.c.
Referenced by IMB_moviecache_destruct(), IMB_moviecache_init(), and IMB_moviecache_put().