diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 7 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_relations.h | 13 | ||||
-rw-r--r-- | source/blender/sequencer/intern/image_cache.c | 54 | ||||
-rw-r--r-- | source/blender/sequencer/intern/image_cache.h | 2 | ||||
-rw-r--r-- | source/blender/sequencer/intern/prefetch.c | 15 | ||||
-rw-r--r-- | source/blender/sequencer/intern/prefetch.h | 2 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.c | 73 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.c | 1 |
11 files changed, 51 insertions, 126 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index e79b5d3e2c8..6561d775536 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1891,8 +1891,6 @@ class SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel): col.prop(ed, "use_cache_preprocessed", text="Pre-Processed") col.prop(ed, "use_cache_composite", text="Composite") col.prop(ed, "use_cache_final", text="Final") - col.separator() - col.prop(ed, "recycle_max_cost") class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel): diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 1b213746add..2ee0dcea5e5 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2111,8 +2111,10 @@ static bool draw_cache_view_init_fn(void *userdata, size_t item_count) } /* Called as a callback */ -static bool draw_cache_view_iter_fn( - void *userdata, struct Sequence *seq, int timeline_frame, int cache_type, float UNUSED(cost)) +static bool draw_cache_view_iter_fn(void *userdata, + struct Sequence *seq, + int timeline_frame, + int cache_type) { CacheDrawData *drawdata = userdata; struct View2D *v2d = drawdata->v2d; diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 1f16fa6d148..ef14a5c52d4 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -278,7 +278,7 @@ typedef struct Editing { struct SeqCache *cache; /* Cache control */ - float recycle_max_cost; + float recycle_max_cost; /* UNUSED only for versioning. */ int cache_flag; struct PrefetchJob *prefetch_job; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 4ab32d54665..eed976c8df1 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -2101,13 +2101,6 @@ static void rna_def_editor(BlenderRNA *brna) "Prefetch Frames", "Render frames ahead of current frame in the background for faster playback"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); - - prop = RNA_def_property(srna, "recycle_max_cost", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0f, SEQ_CACHE_COST_MAX); - RNA_def_property_ui_range(prop, 0.0f, SEQ_CACHE_COST_MAX, 0.1f, 1); - RNA_def_property_float_sdna(prop, NULL, "recycle_max_cost"); - RNA_def_property_ui_text( - prop, "Recycle Up to Cost", "Only frames with cost lower than this value will be recycled"); } static void rna_def_filter_video(StructRNA *srna) diff --git a/source/blender/sequencer/SEQ_relations.h b/source/blender/sequencer/SEQ_relations.h index d0c5d2a474b..b2e7ac9f007 100644 --- a/source/blender/sequencer/SEQ_relations.h +++ b/source/blender/sequencer/SEQ_relations.h @@ -60,14 +60,11 @@ void SEQ_relations_check_uuids_unique_and_report(const struct Scene *scene); void SEQ_relations_session_uuid_generate(struct Sequence *sequence); void SEQ_cache_cleanup(struct Scene *scene); -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)); #ifdef __cplusplus } #endif 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; diff --git a/source/blender/sequencer/intern/image_cache.h b/source/blender/sequencer/intern/image_cache.h index ab28b1d3204..41e8c4d1d48 100644 --- a/source/blender/sequencer/intern/image_cache.h +++ b/source/blender/sequencer/intern/image_cache.h @@ -47,14 +47,12 @@ void seq_cache_put(const struct SeqRenderData *context, float timeline_frame, int type, struct ImBuf *i, - float cost, bool skip_disk_cache); bool seq_cache_put_if_possible(const struct SeqRenderData *context, struct Sequence *seq, float timeline_frame, int type, struct ImBuf *nval, - float cost, bool skip_disk_cache); bool seq_cache_recycle_item(struct Scene *scene); void seq_cache_free_temp_cache(struct Scene *scene, short id, int timeline_frame); diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index 5ffb2287e1c..55df17c01f9 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -178,7 +178,7 @@ static bool seq_prefetch_is_cache_full(Scene *scene) { PrefetchJob *pfjob = seq_prefetch_job_get(scene); - if (!seq_cache_is_full(pfjob->scene)) { + if (!seq_cache_is_full()) { return false; } @@ -528,7 +528,7 @@ static PrefetchJob *seq_prefetch_start_ex(const SeqRenderData *context, float cf } /* Start or resume prefetching*/ -void seq_prefetch_start(const SeqRenderData *context, float timeline_frame, float cost) +void seq_prefetch_start(const SeqRenderData *context, float timeline_frame) { Scene *scene = context->scene; Editing *ed = scene->ed; @@ -540,13 +540,12 @@ void seq_prefetch_start(const SeqRenderData *context, float timeline_frame, floa bool running = seq_prefetch_job_is_running(scene); seq_prefetch_resume(scene); /* conditions to start: - * prefetch enabled, prefetch not running, not scrubbing, - * not playing and rendering-expensive footage, cache storage enabled, has strips to render, - * not rendering, not doing modal transform - important, see D7820. + * prefetch enabled, prefetch not running, not scrubbing, not playing, + * cache storage enabled, has strips to render, not rendering, not doing modal transform - + * important, see D7820. */ - if ((ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !running && !scrubbing && - !(playing && cost > 0.9) && ed->cache_flag & SEQ_CACHE_ALL_TYPES && has_strips && - !G.is_rendering && !G.moving) { + if ((ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !running && !scrubbing && !playing && + ed->cache_flag & SEQ_CACHE_ALL_TYPES && has_strips && !G.is_rendering && !G.moving) { seq_prefetch_start_ex(context, timeline_frame); } diff --git a/source/blender/sequencer/intern/prefetch.h b/source/blender/sequencer/intern/prefetch.h index 44aedb537ae..8cfc6bf90bd 100644 --- a/source/blender/sequencer/intern/prefetch.h +++ b/source/blender/sequencer/intern/prefetch.h @@ -35,7 +35,7 @@ struct Sequence; } #endif -void seq_prefetch_start(const struct SeqRenderData *context, float timeline_frame, float cost); +void seq_prefetch_start(const struct SeqRenderData *context, float timeline_frame); void seq_prefetch_free(struct Scene *scene); bool seq_prefetch_job_is_running(struct Scene *scene); void seq_prefetch_get_time_range(struct Scene *scene, int *start, int *end); diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 524bf7cd74c..8d6a61f3c5d 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -403,24 +403,6 @@ int seq_get_shown_sequences(ListBase *seqbasep, return cnt; } -/* Estimate time spent by the program rendering the strip */ -static clock_t seq_estimate_render_cost_begin(void) -{ - return clock(); -} - -static float seq_estimate_render_cost_end(Scene *scene, clock_t begin) -{ - clock_t end = clock(); - float time_spent = (float)(end - begin); - float time_max = (1.0f / scene->r.frs_sec) * CLOCKS_PER_SEC; - - if (time_max != 0) { - return time_spent / time_max; - } - - return 1; -} /** \} */ /* -------------------------------------------------------------------- */ @@ -738,7 +720,6 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, float timeline_frame, - clock_t begin, bool use_preprocess, const bool is_proxy_image) { @@ -748,20 +729,15 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, } if (use_preprocess) { - float cost = seq_estimate_render_cost_end(context->scene, begin); - /* Proxies are not stored in cache. */ if (!is_proxy_image) { - seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, cost, false); + seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, false); } - /* Reset timer so we can get partial render time. */ - begin = seq_estimate_render_cost_begin(); ibuf = input_preprocess(context, seq, timeline_frame, ibuf); } - float cost = seq_estimate_render_cost_end(context->scene, begin); - seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false); + seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, false); return ibuf; } @@ -1073,7 +1049,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, if (view_id != context->view_id) { ibufs_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibufs_arr[view_id], timeline_frame, clock(), true, false); + &localcontext, seq, ibufs_arr[view_id], timeline_frame, true, false); } } @@ -1223,7 +1199,7 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context, if (view_id != context->view_id) { ibuf_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibuf_arr[view_id], timeline_frame, clock(), true, false); + &localcontext, seq, ibuf_arr[view_id], timeline_frame, true, false); } } @@ -1630,7 +1606,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, if (view_id != context->view_id) { seq_cache_put( - &localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false); + &localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], false); } RE_ReleaseResultImage(re); @@ -1805,8 +1781,6 @@ ImBuf *seq_render_strip(const SeqRenderData *context, bool use_preprocess = false; bool is_proxy_image = false; - clock_t begin = seq_estimate_render_cost_begin(); - ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, false); if (ibuf != NULL) { return ibuf; @@ -1824,7 +1798,7 @@ ImBuf *seq_render_strip(const SeqRenderData *context, if (ibuf) { use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame); ibuf = seq_render_preprocess_ibuf( - context, seq, ibuf, timeline_frame, begin, use_preprocess, is_proxy_image); + context, seq, ibuf, timeline_frame, use_preprocess, is_proxy_image); } if (ibuf == NULL) { @@ -1910,7 +1884,6 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, int count; int i; ImBuf *out = NULL; - clock_t begin; count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); @@ -1946,16 +1919,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, break; case EARLY_DO_EFFECT: if (i == 0) { - begin = seq_estimate_render_cost_begin(); - ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); - float cost = seq_estimate_render_cost_end(context->scene, begin); seq_cache_put( - context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -1969,7 +1939,6 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, i++; for (; i < count; i++) { - begin = seq_estimate_render_cost_begin(); Sequence *seq = seq_arr[i]; if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { @@ -1982,9 +1951,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, IMB_freeImBuf(ibuf2); } - float cost = seq_estimate_render_cost_end(context->scene, begin); - seq_cache_put( - context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false); } return out; @@ -2029,36 +1996,22 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame); - clock_t begin = seq_estimate_render_cost_begin(); - float cost = 0; - if (count && !out) { BLI_mutex_lock(&seq_render_mutex); out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); - cost = seq_estimate_render_cost_end(context->scene, begin); if (context->is_prefetch_render) { - seq_cache_put(context, - seq_arr[count - 1], - timeline_frame, - SEQ_CACHE_STORE_FINAL_OUT, - out, - cost, - false); + seq_cache_put( + context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false); } else { - seq_cache_put_if_possible(context, - seq_arr[count - 1], - timeline_frame, - SEQ_CACHE_STORE_FINAL_OUT, - out, - cost, - false); + seq_cache_put_if_possible( + context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false); } BLI_mutex_unlock(&seq_render_mutex); } - seq_prefetch_start(context, timeline_frame, cost); + seq_prefetch_start(context, timeline_frame); return out; } diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 79e8ba2f6c0..b589a75fa42 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -249,7 +249,6 @@ Editing *SEQ_editing_ensure(Scene *scene) ed->cache_flag = SEQ_CACHE_STORE_FINAL_OUT; ed->cache_flag |= SEQ_CACHE_VIEW_FINAL_OUT; ed->cache_flag |= SEQ_CACHE_VIEW_ENABLE; - ed->recycle_max_cost = 10.0f; } return scene->ed; |