Blender  V3.3
Classes | Macros | Functions | Variables
moviecache.cc File Reference
#include <cstdlib>
#include <memory.h>
#include <mutex>
#include "MEM_CacheLimiterC-Api.h"
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_mempool.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "IMB_moviecache.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"

Go to the source code of this file.

Classes

struct  MovieCache
 
struct  MovieCacheKey
 
struct  MovieCacheItem
 

Macros

#define PRINT(format, ...)
 

Functions

static unsigned int moviecache_hashhash (const void *keyv)
 
static bool 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 moviecache_destructor (void *p)
 
static size_t get_size_in_memory (ImBuf *ibuf)
 
static size_t get_item_size (void *p)
 
static int get_item_priority (void *item_v, int default_priority)
 
static bool get_item_destroyable (void *item_v)
 
void IMB_moviecache_init (void)
 
void IMB_moviecache_destruct (void)
 
MovieCacheIMB_moviecache_create (const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
 
void IMB_moviecache_set_getdata_callback (MovieCache *cache, MovieCacheGetKeyDataFP getdatafp)
 
void IMB_moviecache_set_priority_callback (struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp, MovieCacheGetItemPriorityFP getitempriorityfp, MovieCachePriorityDeleterFP prioritydeleterfp)
 
static void do_moviecache_put (MovieCache *cache, void *userkey, ImBuf *ibuf, bool need_lock)
 
void IMB_moviecache_put (MovieCache *cache, void *userkey, ImBuf *ibuf)
 
bool IMB_moviecache_put_if_possible (MovieCache *cache, void *userkey, ImBuf *ibuf)
 
void IMB_moviecache_remove (MovieCache *cache, void *userkey)
 
ImBufIMB_moviecache_get (MovieCache *cache, void *userkey, bool *r_is_cached_empty)
 
bool IMB_moviecache_has_frame (MovieCache *cache, void *userkey)
 
void IMB_moviecache_free (MovieCache *cache)
 
void IMB_moviecache_cleanup (MovieCache *cache, bool(cleanup_check_cb)(ImBuf *ibuf, void *userkey, void *userdata), void *userdata)
 
void IMB_moviecache_get_cache_segments (MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
 
struct MovieCacheIter * IMB_moviecacheIter_new (MovieCache *cache)
 
void IMB_moviecacheIter_free (struct MovieCacheIter *iter)
 
bool IMB_moviecacheIter_done (struct MovieCacheIter *iter)
 
void IMB_moviecacheIter_step (struct MovieCacheIter *iter)
 
ImBufIMB_moviecacheIter_getImBuf (struct MovieCacheIter *iter)
 
voidIMB_moviecacheIter_getUserKey (struct MovieCacheIter *iter)
 

Variables

static MEM_CacheLimiterClimitor = nullptr
 
static std::recursive_mutex limitor_lock
 

Macro Definition Documentation

◆ PRINT

#define PRINT (   format,
  ... 
)

Definition at line 35 of file moviecache.cc.

Function Documentation

◆ check_unused_keys()

static void check_unused_keys ( MovieCache cache)
static

◆ compare_int()

static int compare_int ( const void av,
const void bv 
)
static

Definition at line 162 of file moviecache.cc.

References Freestyle::a, and usdtokens::b().

Referenced by IMB_moviecache_get_cache_segments().

◆ do_moviecache_put()

static void do_moviecache_put ( MovieCache cache,
void userkey,
ImBuf ibuf,
bool  need_lock 
)
static

◆ get_item_destroyable()

static bool get_item_destroyable ( void item_v)
static

Definition at line 232 of file moviecache.cc.

References IB_BITMAPDIRTY, IB_PERSISTENT, MovieCacheItem::ibuf, and ImBuf::userflags.

Referenced by IMB_moviecache_init().

◆ get_item_priority()

static int get_item_priority ( void item_v,
int  default_priority 
)
static

◆ get_item_size()

static size_t get_item_size ( void p)
static

Definition at line 197 of file moviecache.cc.

References get_size_in_memory(), MovieCacheItem::ibuf, and size().

Referenced by IMB_moviecache_init().

◆ get_size_in_memory()

static size_t get_size_in_memory ( ImBuf ibuf)
static

◆ IMB_moviecache_cleanup()

void IMB_moviecache_cleanup ( MovieCache cache,
bool(cleanup_check_cb)(ImBuf *ibuf, void *userkey, void *userdata)  ,
void userdata 
)

◆ IMB_moviecache_create()

MovieCache* IMB_moviecache_create ( const char *  name,
int  keysize,
GHashHashFP  hashfp,
GHashCmpFP  cmpfp 
)

◆ IMB_moviecache_destruct()

void IMB_moviecache_destruct ( void  )

◆ IMB_moviecache_free()

void IMB_moviecache_free ( MovieCache cache)

◆ IMB_moviecache_get()

ImBuf* IMB_moviecache_get ( MovieCache cache,
void userkey,
bool r_is_cached_empty 
)

◆ IMB_moviecache_get_cache_segments()

void IMB_moviecache_get_cache_segments ( struct MovieCache cache,
int  proxy,
int  render_flags,
int *  r_totseg,
int **  r_points 
)

◆ IMB_moviecache_has_frame()

bool IMB_moviecache_has_frame ( MovieCache cache,
void userkey 
)

◆ IMB_moviecache_init()

void IMB_moviecache_init ( void  )

◆ IMB_moviecache_put()

void IMB_moviecache_put ( MovieCache cache,
void userkey,
ImBuf ibuf 
)

Definition at line 367 of file moviecache.cc.

References do_moviecache_put().

Referenced by colormanage_cache_put(), imagecache_put(), and put_imbuf_cache().

◆ IMB_moviecache_put_if_possible()

bool IMB_moviecache_put_if_possible ( MovieCache cache,
void userkey,
ImBuf ibuf 
)

◆ IMB_moviecache_remove()

void IMB_moviecache_remove ( MovieCache cache,
void userkey 
)

◆ IMB_moviecache_set_getdata_callback()

void IMB_moviecache_set_getdata_callback ( MovieCache cache,
MovieCacheGetKeyDataFP  getdatafp 
)

Definition at line 292 of file moviecache.cc.

References MovieCache::getdatafp.

Referenced by imagecache_put(), and put_imbuf_cache().

◆ IMB_moviecache_set_priority_callback()

void IMB_moviecache_set_priority_callback ( struct MovieCache cache,
MovieCacheGetPriorityDataFP  getprioritydatafp,
MovieCacheGetItemPriorityFP  getitempriorityfp,
MovieCachePriorityDeleterFP  prioritydeleterfp 
)

◆ IMB_moviecacheIter_done()

bool IMB_moviecacheIter_done ( struct MovieCacheIter *  iter)

◆ IMB_moviecacheIter_free()

void IMB_moviecacheIter_free ( struct MovieCacheIter *  iter)

◆ IMB_moviecacheIter_getImBuf()

ImBuf* IMB_moviecacheIter_getImBuf ( struct MovieCacheIter *  iter)

◆ IMB_moviecacheIter_getUserKey()

void* IMB_moviecacheIter_getUserKey ( struct MovieCacheIter *  iter)

Definition at line 606 of file moviecache.cc.

References BLI_ghashIterator_getKey(), and MovieCacheKey::userkey.

Referenced by BKE_image_merge().

◆ IMB_moviecacheIter_new()

struct MovieCacheIter* IMB_moviecacheIter_new ( MovieCache cache)

◆ IMB_moviecacheIter_step()

void IMB_moviecacheIter_step ( struct MovieCacheIter *  iter)

◆ moviecache_destructor()

static void moviecache_destructor ( void p)
static

◆ moviecache_hashcmp()

static bool moviecache_hashcmp ( const void av,
const void bv 
)
static

Definition at line 91 of file moviecache.cc.

References Freestyle::a, and usdtokens::b().

Referenced by IMB_moviecache_create().

◆ moviecache_hashhash()

static unsigned int moviecache_hashhash ( const void keyv)
static

◆ moviecache_keyfree()

static void moviecache_keyfree ( void val)
static

◆ moviecache_valfree()

static void moviecache_valfree ( void val)
static

Variable Documentation

◆ limitor

MEM_CacheLimiterC* limitor = nullptr
static

◆ limitor_lock

std::recursive_mutex limitor_lock
static