Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-23 04:01:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-23 04:22:22 +0300
commit64b4b719ebd5201d27aa25d7fa2d765eabded9b0 (patch)
treec6e1147f3b81b90193d3acaa0df3f8c5c93db328 /source/blender/imbuf/intern/moviecache.c
parentac53291e1ff79144ca41d63b0787bfe04da21677 (diff)
Cleanup: style, use braces for imbuf
Diffstat (limited to 'source/blender/imbuf/intern/moviecache.c')
-rw-r--r--source/blender/imbuf/intern/moviecache.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index fe6909b0f3f..4424e5548ca 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -151,8 +151,9 @@ static void check_unused_keys(MovieCache *cache)
PRINT("%s: cache '%s' remove item %p without buffer\n", __func__, cache->name, item);
}
- if (remove)
+ if (remove) {
BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
+ }
}
}
@@ -205,18 +206,21 @@ static size_t IMB_get_size_in_memory(ImBuf *ibuf)
size += sizeof(ImBuf);
- if (ibuf->rect)
+ if (ibuf->rect) {
channel_size += sizeof(char);
+ }
- if (ibuf->rect_float)
+ if (ibuf->rect_float) {
channel_size += sizeof(float);
+ }
size += channel_size * ibuf->x * ibuf->y * ibuf->channels;
if (ibuf->miptot) {
for (a = 0; a < ibuf->miptot; a++) {
- if (ibuf->mipmap[a])
+ if (ibuf->mipmap[a]) {
size += IMB_get_size_in_memory(ibuf->mipmap[a]);
+ }
}
}
@@ -232,8 +236,9 @@ static size_t get_item_size(void *p)
size_t size = sizeof(MovieCacheItem);
MovieCacheItem *item = (MovieCacheItem *)p;
- if (item->ibuf)
+ if (item->ibuf) {
size += IMB_get_size_in_memory(item->ibuf);
+ }
return size;
}
@@ -285,8 +290,9 @@ void IMB_moviecache_init(void)
void IMB_moviecache_destruct(void)
{
- if (limitor)
+ if (limitor) {
delete_MEM_CacheLimiter(limitor);
+ }
}
MovieCache *IMB_moviecache_create(const char *name,
@@ -338,8 +344,9 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
MovieCacheKey *key;
MovieCacheItem *item;
- if (!limitor)
+ if (!limitor) {
IMB_moviecache_init();
+ }
IMB_refImBuf(ibuf);
@@ -367,8 +374,9 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
memcpy(cache->last_userkey, userkey, cache->keysize);
}
- if (need_lock)
+ if (need_lock) {
BLI_mutex_lock(&limitor_lock);
+ }
item->c_handle = MEM_CacheLimiter_insert(limitor, item);
@@ -376,8 +384,9 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
MEM_CacheLimiter_enforce_limits(limitor);
MEM_CacheLimiter_unref(item->c_handle);
- if (need_lock)
+ if (need_lock) {
BLI_mutex_unlock(&limitor_lock);
+ }
/* cache limiter can't remove unused keys which points to destroyed values */
check_unused_keys(cache);
@@ -460,11 +469,13 @@ void IMB_moviecache_free(MovieCache *cache)
BLI_mempool_destroy(cache->items_pool);
BLI_mempool_destroy(cache->userkeys_pool);
- if (cache->points)
+ if (cache->points) {
MEM_freeN(cache->points);
+ }
- if (cache->last_userkey)
+ if (cache->last_userkey) {
MEM_freeN(cache->last_userkey);
+ }
MEM_freeN(cache);
}
@@ -500,12 +511,14 @@ void IMB_moviecache_get_cache_segments(
*totseg_r = 0;
*points_r = NULL;
- if (!cache->getdatafp)
+ if (!cache->getdatafp) {
return;
+ }
if (cache->proxy != proxy || cache->render_flags != render_flags) {
- if (cache->points)
+ if (cache->points) {
MEM_freeN(cache->points);
+ }
cache->points = NULL;
}
@@ -529,8 +542,9 @@ void IMB_moviecache_get_cache_segments(
if (item->ibuf) {
cache->getdatafp(key->userkey, &framenr, &curproxy, &curflags);
- if (curproxy == proxy && curflags == render_flags)
+ if (curproxy == proxy && curflags == render_flags) {
frames[a++] = framenr;
+ }
}
}
@@ -538,11 +552,13 @@ void IMB_moviecache_get_cache_segments(
/* count */
for (a = 0; a < totframe; a++) {
- if (a && frames[a] - frames[a - 1] != 1)
+ if (a && frames[a] - frames[a - 1] != 1) {
totseg++;
+ }
- if (a == totframe - 1)
+ if (a == totframe - 1) {
totseg++;
+ }
}
if (totseg) {
@@ -552,16 +568,18 @@ void IMB_moviecache_get_cache_segments(
/* fill */
for (a = 0, b = 0; a < totframe; a++) {
- if (a == 0)
+ if (a == 0) {
points[b++] = frames[a];
+ }
if (a && frames[a] - frames[a - 1] != 1) {
points[b++] = frames[a - 1];
points[b++] = frames[a];
}
- if (a == totframe - 1)
+ if (a == totframe - 1) {
points[b++] = frames[a];
+ }
}
*totseg_r = totseg;