[Bf-blender-cvs] [38b77ef8b22] master: VSE: Remove cost calculation from cache

Richard Antalik noreply at git.blender.org
Sun Dec 20 04:09:28 CET 2020


Commit: 38b77ef8b22173835b3bc80efc218c3e05b9e37d
Author: Richard Antalik
Date:   Sun Dec 20 03:58:38 2020 +0100
Branches: master
https://developer.blender.org/rB38b77ef8b22173835b3bc80efc218c3e05b9e37d

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.

===================================================================

M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/makesdna/DNA_sequence_types.h
M	source/blender/makesrna/intern/rna_sequencer.c
M	source/blender/sequencer/SEQ_relations.h
M	source/blender/sequencer/intern/image_cache.c
M	source/blender/sequencer/intern/image_cache.h
M	source/blender/sequencer/intern/prefetch.c
M	source/blender/sequencer/intern/prefetch.h
M	source/blender/sequencer/intern/render.c
M	source/blender/sequencer/intern/sequencer.c

===================================================================

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_pref

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list