diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-12-20 05:58:38 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-12-20 05:58:38 +0300 |
commit | 38b77ef8b22173835b3bc80efc218c3e05b9e37d (patch) | |
tree | 3575ab870d073a08a630d1c13b4df5548de3f9ea /source/blender/sequencer/intern/image_cache.c | |
parent | c4ff91aab76a9987ec109a733d39ff800ccbd15b (diff) |
VSE: Remove cost calculation from cache
This value was meant to be used for keeping images that are slowest to
render in cache. Method of measurement was flawed, because it doesn't
take UI overhead into consideration.
Cache panel is to be removed because users should not have to tweak
settings like this. It is not useful for development either, therefore
it is removed completely.
Diffstat (limited to 'source/blender/sequencer/intern/image_cache.c')
-rw-r--r-- | source/blender/sequencer/intern/image_cache.c | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index 2cc25ae8d38..40ad70cf9a0 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -938,7 +938,6 @@ static SeqCacheKey *seq_cache_get_item_for_removal(Scene *scene) GHashIterator gh_iter; BLI_ghashIterator_init(&gh_iter, cache->hash); int total_count = 0; - int cheap_count = 0; while (!BLI_ghashIterator_done(&gh_iter)) { key = BLI_ghashIterator_getKey(&gh_iter); @@ -959,25 +958,22 @@ static SeqCacheKey *seq_cache_get_item_for_removal(Scene *scene) total_count++; - if (key->cost <= scene->ed->recycle_max_cost) { - cheap_count++; - if (lkey) { - if (key->timeline_frame < lkey->timeline_frame) { - lkey = key; - } - } - else { + if (lkey) { + if (key->timeline_frame < lkey->timeline_frame) { lkey = key; } - if (rkey) { - if (key->timeline_frame > rkey->timeline_frame) { - rkey = key; - } - } - else { + } + else { + lkey = key; + } + if (rkey) { + if (key->timeline_frame > rkey->timeline_frame) { rkey = key; } } + else { + rkey = key; + } } finalkey = seq_cache_choose_key(scene, lkey, rkey); @@ -1281,10 +1277,10 @@ struct ImBuf *seq_cache_get(const SeqRenderData *context, BLI_mutex_unlock(&cache->disk_cache->read_write_mutex); if (ibuf) { if (key.type == SEQ_CACHE_STORE_FINAL_OUT) { - seq_cache_put_if_possible(context, seq, timeline_frame, type, ibuf, 0.0f, true); + seq_cache_put_if_possible(context, seq, timeline_frame, type, ibuf, true); } else { - seq_cache_put(context, seq, timeline_frame, type, ibuf, 0.0f, true); + seq_cache_put(context, seq, timeline_frame, type, ibuf, true); } } } @@ -1297,7 +1293,6 @@ bool seq_cache_put_if_possible(const SeqRenderData *context, float timeline_frame, int type, ImBuf *ibuf, - float cost, bool skip_disk_cache) { Scene *scene = context->scene; @@ -1313,7 +1308,7 @@ bool seq_cache_put_if_possible(const SeqRenderData *context, } if (seq_cache_recycle_item(scene)) { - seq_cache_put(context, seq, timeline_frame, type, ibuf, cost, skip_disk_cache); + seq_cache_put(context, seq, timeline_frame, type, ibuf, skip_disk_cache); return true; } @@ -1327,7 +1322,6 @@ void seq_cache_put(const SeqRenderData *context, float timeline_frame, int type, ImBuf *i, - float cost, bool skip_disk_cache) { if (i == NULL || context->skip_cache || context->is_proxy_render || !seq) { @@ -1370,10 +1364,6 @@ void seq_cache_put(const SeqRenderData *context, flag = scene->ed->cache_flag; } - if (cost > SEQ_CACHE_COST_MAX) { - cost = SEQ_CACHE_COST_MAX; - } - SeqCacheKey *key; key = BLI_mempool_alloc(cache->keys_pool); key->cache_owner = cache; @@ -1382,7 +1372,6 @@ void seq_cache_put(const SeqRenderData *context, key->frame_index = seq_cache_timeline_frame_to_frame_index(seq, timeline_frame, type); key->timeline_frame = timeline_frame; key->type = type; - key->cost = cost; key->link_prev = NULL; key->link_next = NULL; key->is_temp_cache = true; @@ -1430,14 +1419,11 @@ void seq_cache_put(const SeqRenderData *context, } } -void SEQ_cache_iterate(struct Scene *scene, - void *userdata, - bool callback_init(void *userdata, size_t item_count), - bool callback_iter(void *userdata, - struct Sequence *seq, - int timeline_frame, - int cache_type, - float cost)) +void SEQ_cache_iterate( + struct Scene *scene, + void *userdata, + bool callback_init(void *userdata, size_t item_count), + bool callback_iter(void *userdata, struct Sequence *seq, int timeline_frame, int cache_type)) { SeqCache *cache = seq_cache_get_from_scene(scene); if (!cache) { @@ -1454,7 +1440,7 @@ void SEQ_cache_iterate(struct Scene *scene, SeqCacheKey *key = BLI_ghashIterator_getKey(&gh_iter); BLI_ghashIterator_step(&gh_iter); - interrupt = callback_iter(userdata, key->seq, key->timeline_frame, key->type, key->cost); + interrupt = callback_iter(userdata, key->seq, key->timeline_frame, key->type); } cache->last_key = NULL; |