Blender V4.3
image_cache.cc File Reference
#include <cstddef>
#include <ctime>
#include <memory.h>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "BLI_fileops_types.h"
#include "BLI_ghash.h"
#include "BLI_mempool.h"
#include "BLI_threads.h"
#include "BKE_main.hh"
#include "SEQ_prefetch.hh"
#include "SEQ_relations.hh"
#include "SEQ_render.hh"
#include "SEQ_time.hh"
#include "disk_cache.hh"
#include "image_cache.hh"
#include "prefetch.hh"

Go to the source code of this file.

Classes

struct  SeqCache
 
struct  SeqCacheItem
 

Functions

static bool seq_cmp_render_data (const SeqRenderData *a, const SeqRenderData *b)
 
static uint seq_hash_render_data (const SeqRenderData *a)
 
static uint seq_cache_hashhash (const void *key_)
 
static bool seq_cache_hashcmp (const void *a_, const void *b_)
 
static float seq_cache_timeline_frame_to_frame_index (const Scene *scene, const Sequence *seq, const float timeline_frame, const int type)
 
float seq_cache_frame_index_to_timeline_frame (Sequence *seq, float frame_index)
 
static SeqCacheseq_cache_get_from_scene (Scene *scene)
 
static void seq_cache_lock (Scene *scene)
 
static void seq_cache_unlock (Scene *scene)
 
static size_t seq_cache_get_mem_total ()
 
static void seq_cache_keyfree (void *val)
 
static void seq_cache_valfree (void *val)
 
static int get_stored_types_flag (Scene *scene, SeqCacheKey *key)
 
static void seq_cache_put_ex (Scene *scene, SeqCacheKey *key, ImBuf *ibuf)
 
static ImBufseq_cache_get_ex (SeqCache *cache, SeqCacheKey *key)
 
static void seq_cache_key_unlink (SeqCacheKey *key)
 
static SeqCacheKeyseq_cache_choose_key (Scene *scene, SeqCacheKey *lkey, SeqCacheKey *rkey)
 
static void seq_cache_recycle_linked (Scene *scene, SeqCacheKey *base)
 
static SeqCacheKeyseq_cache_get_item_for_removal (Scene *scene)
 
bool seq_cache_recycle_item (Scene *scene)
 
static void seq_cache_set_temp_cache_linked (Scene *scene, SeqCacheKey *base)
 
static void seq_cache_create (Main *bmain, Scene *scene)
 
static void seq_cache_populate_key (SeqCacheKey *key, const SeqRenderData *context, Sequence *seq, const float timeline_frame, const int type)
 
static SeqCacheKeyseq_cache_allocate_key (SeqCache *cache, const SeqRenderData *context, Sequence *seq, const float timeline_frame, const int type)
 
void seq_cache_free_temp_cache (Scene *scene, short id, int timeline_frame)
 
void seq_cache_destruct (Scene *scene)
 
void SEQ_cache_cleanup (Scene *scene)
 
void seq_cache_cleanup_sequence (Scene *scene, Sequence *seq, Sequence *seq_changed, int invalidate_types, bool force_seq_changed_range)
 
ImBufseq_cache_get (const SeqRenderData *context, Sequence *seq, float timeline_frame, int type)
 
bool seq_cache_put_if_possible (const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *ibuf)
 
void seq_cache_put (const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *i)
 
void SEQ_cache_iterate (Scene *scene, void *userdata, bool callback_init(void *userdata, size_t item_count), bool callback_iter(void *userdata, Sequence *seq, int timeline_frame, int cache_type))
 
bool seq_cache_is_full ()
 

Variables

static ThreadMutex cache_create_lock = BLI_MUTEX_INITIALIZER
 

Function Documentation

◆ get_stored_types_flag()

static int get_stored_types_flag ( Scene * scene,
SeqCacheKey * key )
static

◆ seq_cache_allocate_key()

static SeqCacheKey * seq_cache_allocate_key ( SeqCache * cache,
const SeqRenderData * context,
Sequence * seq,
const float timeline_frame,
const int type )
static

Definition at line 528 of file image_cache.cc.

References BLI_mempool_alloc(), SeqCache::keys_pool, and seq_cache_populate_key().

Referenced by seq_cache_get(), and seq_cache_put().

◆ seq_cache_choose_key()

static SeqCacheKey * seq_cache_choose_key ( Scene * scene,
SeqCacheKey * lkey,
SeqCacheKey * rkey )
static

◆ SEQ_cache_cleanup()

◆ seq_cache_cleanup_sequence()

◆ seq_cache_create()

◆ seq_cache_destruct()

◆ seq_cache_frame_index_to_timeline_frame()

float seq_cache_frame_index_to_timeline_frame ( Sequence * seq,
float frame_index )

Definition at line 141 of file image_cache.cc.

References SEQ_time_start_frame_get().

Referenced by seq_disk_cache_delete_invalid_files().

◆ seq_cache_free_temp_cache()

◆ seq_cache_get()

◆ seq_cache_get_ex()

static ImBuf * seq_cache_get_ex ( SeqCache * cache,
SeqCacheKey * key )
static

Definition at line 248 of file image_cache.cc.

References BLI_ghash_lookup(), SeqCache::hash, SeqCacheItem::ibuf, and IMB_refImBuf().

Referenced by seq_cache_get().

◆ seq_cache_get_from_scene()

◆ seq_cache_get_item_for_removal()

◆ seq_cache_get_mem_total()

static size_t seq_cache_get_mem_total ( )
static

Definition at line 173 of file image_cache.cc.

Referenced by seq_cache_is_full().

◆ seq_cache_hashcmp()

static bool seq_cache_hashcmp ( const void * a_,
const void * b_ )
static

Definition at line 116 of file image_cache.cc.

References b, and seq_cmp_render_data().

Referenced by seq_cache_create().

◆ seq_cache_hashhash()

static uint seq_cache_hashhash ( const void * key_)
static

◆ seq_cache_is_full()

bool seq_cache_is_full ( )

◆ SEQ_cache_iterate()

void SEQ_cache_iterate ( Scene * scene,
void * userdata,
bool callback_initvoid *userdata, size_t item_count,
bool callback_itervoid *userdata, Sequence *seq, int timeline_frame, int cache_type )

◆ seq_cache_key_unlink()

static void seq_cache_key_unlink ( SeqCacheKey * key)
static

◆ seq_cache_keyfree()

◆ seq_cache_lock()

◆ seq_cache_populate_key()

◆ seq_cache_put()

◆ seq_cache_put_ex()

◆ seq_cache_put_if_possible()

bool seq_cache_put_if_possible ( const SeqRenderData * context,
Sequence * seq,
float timeline_frame,
int type,
ImBuf * ibuf )

◆ seq_cache_recycle_item()

bool seq_cache_recycle_item ( Scene * scene)

Find only "base" keys. Sources(other types) for a frame must be freed all at once.

Definition at line 441 of file image_cache.cc.

References seq_cache_get_from_scene(), seq_cache_get_item_for_removal(), seq_cache_is_full(), seq_cache_lock(), seq_cache_recycle_linked(), and seq_cache_unlock().

Referenced by seq_cache_get(), seq_cache_put_if_possible(), and seq_prefetch_is_cache_full().

◆ seq_cache_recycle_linked()

◆ seq_cache_set_temp_cache_linked()

static void seq_cache_set_temp_cache_linked ( Scene * scene,
SeqCacheKey * base )
static

◆ seq_cache_timeline_frame_to_frame_index()

static float seq_cache_timeline_frame_to_frame_index ( const Scene * scene,
const Sequence * seq,
const float timeline_frame,
const int type )
static

◆ seq_cache_unlock()

◆ seq_cache_valfree()

◆ seq_cmp_render_data()

static bool seq_cmp_render_data ( const SeqRenderData * a,
const SeqRenderData * b )
static

Definition at line 81 of file image_cache.cc.

References b.

Referenced by seq_cache_hashcmp().

◆ seq_hash_render_data()

static uint seq_hash_render_data ( const SeqRenderData * a)
static

Definition at line 90 of file image_cache.cc.

References int.

Referenced by seq_cache_hashhash().

Variable Documentation

◆ cache_create_lock

ThreadMutex cache_create_lock = BLI_MUTEX_INITIALIZER
static

Definition at line 79 of file image_cache.cc.

Referenced by seq_cache_create().