Commit: c74086376fa898a5a34177d5e627aba3b094f0f9 Author: Richard Antalik Date: Fri Nov 6 15:38:00 2020 +0100 Branches: master https://developer.blender.org/rBc74086376fa898a5a34177d5e627aba3b094f0f9
VSE: Don't store proxy images in cache Proxies are expected to be fast to read. Storing them in cache has little to no effect on performance. This change also allows to omit invalidation of cache when user switch between proxies and original media. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9473 =================================================================== M source/blender/makesrna/intern/rna_sequencer.c M source/blender/sequencer/intern/render.c =================================================================== diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 1882fce3f54..07f3672cb0a 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -956,8 +956,7 @@ static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Scene *scene = (Scene *)ptr->owner_id; Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq = sequence_get_by_proxy(ed, ptr->data); - - BKE_sequence_invalidate_cache_raw(scene, seq); + BKE_sequence_invalidate_cache_preprocessed(scene, seq); } /* do_versions? */ @@ -1513,12 +1512,12 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR); RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE); RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); } static void rna_def_color_balance(BlenderRNA *brna) @@ -2182,7 +2181,7 @@ static void rna_def_proxy(StructRNA *srna) RNA_def_property_ui_text( prop, "Use Proxy / Timecode", "Use a preview proxy and/or time-code index for this strip"); RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy"); diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 2a11c61d137..f6d80602f4c 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -655,8 +655,7 @@ static void multibuf(ImBuf *ibuf, const float fmul) static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, float timeline_frame, - ImBuf *ibuf, - const bool UNUSED(is_proxy_image)) + ImBuf *ibuf) { Scene *scene = context->scene; ImBuf *preprocessed_ibuf = NULL; @@ -796,9 +795,7 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, if (use_preprocess) { float cost = seq_estimate_render_cost_end(context->scene, begin); - /* TODO(Richard): It should be possible to store in cache if image is proxy, - * but it adds quite a bit of complexity. Since proxies are fast to read, I would - * rather simplify existing code a bit. */ + /* Proxies are not stored in cache. */ if (!is_proxy_image) { BKE_sequencer_cache_put( context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, cost, false); @@ -806,7 +803,7 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, /* Reset timer so we can get partial render time. */ begin = seq_estimate_render_cost_begin(); - ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image); + ibuf = input_preprocess(context, seq, timeline_frame, ibuf); } float cost = seq_estimate_render_cost_end(context->scene, begin); @@ -1865,7 +1862,11 @@ ImBuf *seq_render_strip(const SeqRenderData *context, return ibuf; } - ibuf = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, false); + /* Proxies are not stored in cache. */ + if (!SEQ_can_use_proxy(seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) { + ibuf = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, false); + } + if (ibuf == NULL) { ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs