Blender V2.61 - r43446
|
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_memarena.h"
#include "BLI_threads.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_filetype.h"
#include "imbuf.h"
Go to the source code of this file.
Classes | |
struct | ImGlobalTile |
struct | ImThreadTile |
struct | ImThreadTileCache |
struct | ImGlobalTileCache |
Defines | |
#define | IB_THREAD_CACHE_SIZE 100 |
Typedefs | |
typedef struct ImGlobalTile | ImGlobalTile |
typedef struct ImThreadTile | ImThreadTile |
typedef struct ImThreadTileCache | ImThreadTileCache |
typedef struct ImGlobalTileCache | ImGlobalTileCache |
Functions | |
static unsigned int | imb_global_tile_hash (const void *gtile_p) |
static int | imb_global_tile_cmp (const void *a_p, const void *b_p) |
static unsigned int | imb_thread_tile_hash (const void *ttile_p) |
static int | imb_thread_tile_cmp (const void *a_p, const void *b_p) |
static void | imb_global_cache_tile_load (ImGlobalTile *gtile) |
static void | imb_global_cache_tile_unload (ImGlobalTile *gtile) |
void | imb_tile_cache_tile_free (ImBuf *ibuf, int tx, int ty) |
static void | imb_thread_cache_init (ImThreadTileCache *cache) |
static void | imb_thread_cache_exit (ImThreadTileCache *cache) |
void | imb_tile_cache_init (void) |
void | imb_tile_cache_exit (void) |
void | IMB_tile_cache_params (int totthread, int maxmem) |
static ImGlobalTile * | imb_global_cache_get_tile (ImBuf *ibuf, int tx, int ty, ImGlobalTile *replacetile) |
static unsigned int * | imb_thread_cache_get_tile (ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty) |
unsigned int * | IMB_gettile (ImBuf *ibuf, int tx, int ty, int thread) |
void | IMB_tiles_to_rect (ImBuf *ibuf) |
Variables | |
static ImGlobalTileCache | GLOBAL_CACHE |
Definition in file cache.c.
#define IB_THREAD_CACHE_SIZE 100 |
Definition at line 51 of file cache.c.
Referenced by imb_thread_cache_init().
typedef struct ImGlobalTile ImGlobalTile |
typedef struct ImGlobalTileCache ImGlobalTileCache |
typedef struct ImThreadTile ImThreadTile |
typedef struct ImThreadTileCache ImThreadTileCache |
unsigned int* IMB_gettile | ( | ImBuf * | ibuf, |
int | tx, | ||
int | ty, | ||
int | thread | ||
) |
Definition at line 403 of file cache.c.
References imb_thread_cache_get_tile(), and ImGlobalTileCache::thread_cache.
static ImGlobalTile* imb_global_cache_get_tile | ( | ImBuf * | ibuf, |
int | tx, | ||
int | ty, | ||
ImGlobalTile * | replacetile | ||
) | [static] |
Definition at line 272 of file cache.c.
References BLI_addhead(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_remove(), BLI_memarena_alloc(), BLI_mutex_lock(), BLI_mutex_unlock(), BLI_remlink(), ListBase::first, ImGlobalTile::ibuf, imb_global_cache_tile_load(), imb_global_cache_tile_unload(), ListBase::last, ImGlobalTile::loading, ImGlobalTileCache::maxmem, ImGlobalTileCache::memarena, ImGlobalTileCache::mutex, NULL, ImGlobalTile::prev, ImGlobalTile::refcount, ImGlobalTileCache::tilehash, ImGlobalTileCache::tiles, ImBuf::tilex, ImBuf::tiley, ImGlobalTileCache::totmem, ImGlobalTile::tx, ImGlobalTile::ty, and ImGlobalTileCache::unused.
Referenced by imb_thread_cache_get_tile(), and IMB_tiles_to_rect().
static void imb_global_cache_tile_load | ( | ImGlobalTile * | gtile | ) | [static] |
Definition at line 133 of file cache.c.
References ImGlobalTile::ibuf, imb_loadtile(), MEM_callocN(), ImBuf::tiles, ImBuf::tilex, ImBuf::tiley, ImGlobalTile::tx, ImGlobalTile::ty, and ImBuf::xtiles.
Referenced by imb_global_cache_get_tile().
static void imb_global_cache_tile_unload | ( | ImGlobalTile * | gtile | ) | [static] |
Definition at line 144 of file cache.c.
References ImGlobalTile::ibuf, MEM_freeN(), NULL, ImBuf::tiles, ImBuf::tilex, ImBuf::tiley, ImGlobalTileCache::totmem, ImGlobalTile::tx, ImGlobalTile::ty, and ImBuf::xtiles.
Referenced by imb_global_cache_get_tile(), and imb_tile_cache_exit().
static int imb_global_tile_cmp | ( | const void * | a_p, |
const void * | b_p | ||
) | [static] |
Definition at line 104 of file cache.c.
References ImGlobalTile::ibuf, ImGlobalTile::tx, and ImGlobalTile::ty.
Referenced by IMB_tile_cache_params().
static unsigned int imb_global_tile_hash | ( | const void * | gtile_p | ) | [static] |
Definition at line 97 of file cache.c.
References ImGlobalTile::ibuf, ImGlobalTile::tx, and ImGlobalTile::ty.
Referenced by IMB_tile_cache_params().
static void imb_thread_cache_exit | ( | ImThreadTileCache * | cache | ) | [static] |
Definition at line 198 of file cache.c.
References BLI_ghash_free(), NULL, and ImThreadTileCache::tilehash.
Referenced by imb_tile_cache_exit().
static unsigned int* imb_thread_cache_get_tile | ( | ImThreadTileCache * | cache, |
ImBuf * | ibuf, | ||
int | tx, | ||
int | ty | ||
) | [static] |
Definition at line 352 of file cache.c.
References BLI_addhead(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_remove(), BLI_remlink(), ListBase::first, ImThreadTile::global, ImThreadTile::ibuf, ImGlobalTile::ibuf, imb_global_cache_get_tile(), ListBase::last, NULL, ImThreadTileCache::tilehash, ImThreadTileCache::tiles, ImBuf::tiles, ImGlobalTile::tx, ImThreadTile::tx, ImThreadTile::ty, ImGlobalTile::ty, ImThreadTileCache::unused, and ImBuf::xtiles.
Referenced by IMB_gettile().
static void imb_thread_cache_init | ( | ImThreadTileCache * | cache | ) | [static] |
Definition at line 182 of file cache.c.
References BLI_addtail(), BLI_ghash_new(), BLI_memarena_alloc(), IB_THREAD_CACHE_SIZE, imb_thread_tile_cmp(), imb_thread_tile_hash(), ImGlobalTileCache::memarena, ImThreadTileCache::tilehash, and ImThreadTileCache::unused.
Referenced by IMB_tile_cache_params().
static int imb_thread_tile_cmp | ( | const void * | a_p, |
const void * | b_p | ||
) | [static] |
Definition at line 121 of file cache.c.
References ImThreadTile::ibuf, ImThreadTile::tx, and ImThreadTile::ty.
Referenced by imb_thread_cache_init().
static unsigned int imb_thread_tile_hash | ( | const void * | ttile_p | ) | [static] |
Definition at line 114 of file cache.c.
References ImThreadTile::ibuf, ImThreadTile::tx, and ImThreadTile::ty.
Referenced by imb_thread_cache_init().
void imb_tile_cache_exit | ( | void | ) |
Definition at line 216 of file cache.c.
References BLI_ghash_free(), BLI_memarena_free(), BLI_mutex_end(), ListBase::first, imb_global_cache_tile_unload(), imb_thread_cache_exit(), ImGlobalTileCache::initialized, ImGlobalTileCache::memarena, ImGlobalTileCache::mutex, ImGlobalTile::next, NULL, ImGlobalTileCache::thread_cache, ImGlobalTileCache::tilehash, ImGlobalTileCache::tiles, and ImGlobalTileCache::totthread.
Referenced by IMB_exit(), and IMB_tile_cache_params().
void imb_tile_cache_init | ( | void | ) |
Definition at line 203 of file cache.c.
References BLI_mutex_init(), IMB_tile_cache_params(), ImGlobalTileCache::initialized, and ImGlobalTileCache::mutex.
Referenced by IMB_init().
void IMB_tile_cache_params | ( | int | totthread, |
int | maxmem | ||
) |
Definition at line 241 of file cache.c.
References BLI_ghash_new(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_memarena_use_calloc(), BLI_mutex_init(), imb_global_tile_cmp(), imb_global_tile_hash(), imb_thread_cache_init(), imb_tile_cache_exit(), ImGlobalTileCache::maxmem, ImGlobalTileCache::memarena, ImGlobalTileCache::mutex, ImGlobalTileCache::thread_cache, ImGlobalTileCache::tilehash, and ImGlobalTileCache::totthread.
Referenced by imb_tile_cache_init().
void imb_tile_cache_tile_free | ( | ImBuf * | ibuf, |
int | tx, | ||
int | ty | ||
) |
Definition at line 156 of file cache.c.
References BLI_addtail(), BLI_ghash_lookup(), BLI_ghash_remove(), BLI_mutex_lock(), BLI_mutex_unlock(), BLI_remlink(), ImGlobalTile::ibuf, ImGlobalTile::loading, ImGlobalTileCache::mutex, NULL, ImGlobalTileCache::tilehash, ImGlobalTileCache::tiles, ImGlobalTile::tx, ImGlobalTile::ty, and ImGlobalTileCache::unused.
Referenced by imb_freetilesImBuf().
void IMB_tiles_to_rect | ( | ImBuf * | ibuf | ) |
Definition at line 408 of file cache.c.
References BLI_mutex_lock(), BLI_mutex_unlock(), ImBuf::flags, IB_rect, IMB_getmipmap(), imb_global_cache_get_tile(), ImBuf::mall, MEM_mapallocN(), ImBuf::miptot, ImGlobalTileCache::mutex, NULL, ImBuf::rect, ImGlobalTile::refcount, ImBuf::tiles, ImBuf::tilex, ImBuf::tiley, simple_enum_gen::w, ImBuf::x, ImBuf::xtiles, ImBuf::y, and ImBuf::ytiles.
ImGlobalTileCache GLOBAL_CACHE [static] |