Implementing part of design outlined in #126087. - VSE thumbnail cache has a new implementation, hopefully simpler and easier to understand. - Instead of cache key being a VSE strip, frame index, plus complicated logic for cache items linking etc., - The cache is keyed by media file path (if multiple strips use the same input file, they will share cache entries), frame index within media file, and any extra data (e.g. steam index for multi-steam videos) - Much reduced cache flickering and strange/weird thumbnail choices. - Likewise, thumbnails no longer disappear-and-reload on operations like Undo, dragging new video strip into timeline, or F12 render. - Thumbnails now load faster. - Images use dedicated/faster thumbnail loading routines when a format can do that (e.g. JPG and EXR can). - Movies reuse ffmpeg decoding context for neighboring strips that use the same file (as often happens when cutting footage) - Thumbnail requests are processed on several threads now too. Images and more detail in PR. Pull Request: https://projects.blender.org/blender/blender/pulls/126405
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
/* SPDX-FileCopyrightText: 2004 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup sequencer
|
|
*/
|
|
|
|
#include "SEQ_render.hh" /* Needed for #eSeqTaskId. */
|
|
|
|
struct ImBuf;
|
|
struct Main;
|
|
struct Scene;
|
|
struct SeqCache;
|
|
struct SeqRenderData;
|
|
struct Sequence;
|
|
|
|
struct SeqCacheKey {
|
|
SeqCache *cache_owner;
|
|
void *userkey;
|
|
SeqCacheKey *link_prev; /* Used for linking intermediate items to final frame. */
|
|
SeqCacheKey *link_next; /* Used for linking intermediate items to final frame. */
|
|
Sequence *seq;
|
|
SeqRenderData context;
|
|
float frame_index; /* Usually same as timeline_frame. Mapped to media for RAW entries. */
|
|
float timeline_frame; /* Only for reference - used for freeing when cache is full. */
|
|
float cost; /* In short: render time(s) divided by playback frame duration(s) */
|
|
bool is_temp_cache; /* this cache entry will be freed before rendering next frame */
|
|
/* ID of task for assigning temp cache entries to particular task(thread, etc.) */
|
|
eSeqTaskId task_id;
|
|
int type;
|
|
};
|
|
|
|
ImBuf *seq_cache_get(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type);
|
|
void seq_cache_put(
|
|
const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *i);
|
|
bool seq_cache_put_if_possible(
|
|
const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *ibuf);
|
|
/**
|
|
* Find only "base" keys.
|
|
* Sources(other types) for a frame must be freed all at once.
|
|
*/
|
|
bool seq_cache_recycle_item(Scene *scene);
|
|
void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame);
|
|
void seq_cache_destruct(Scene *scene);
|
|
void seq_cache_cleanup_sequence(Scene *scene,
|
|
Sequence *seq,
|
|
Sequence *seq_changed,
|
|
int invalidate_types,
|
|
bool force_seq_changed_range);
|
|
bool seq_cache_is_full();
|
|
float seq_cache_frame_index_to_timeline_frame(Sequence *seq, float frame_index);
|