2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2004 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup sequencer
|
|
|
|
|
*/
|
|
|
|
|
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_render.hh" /* Needed for #eSeqTaskId. */
|
2021-10-07 03:04:34 +02:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
struct ImBuf;
|
|
|
|
|
struct Main;
|
|
|
|
|
struct Scene;
|
2024-01-04 15:07:48 -05:00
|
|
|
struct SeqCache;
|
2020-11-16 05:02:30 +01:00
|
|
|
struct SeqRenderData;
|
2020-12-16 16:26:23 +11:00
|
|
|
struct Sequence;
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2023-11-14 09:51:41 +01:00
|
|
|
struct SeqCacheKey {
|
2024-01-04 15:07:48 -05:00
|
|
|
SeqCache *cache_owner;
|
2021-10-07 03:04:34 +02:00
|
|
|
void *userkey;
|
2024-01-04 15:07:48 -05:00
|
|
|
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;
|
2021-10-07 03:04:34 +02:00
|
|
|
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;
|
2023-11-14 09:51:41 +01:00
|
|
|
};
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2023-11-14 09:51:41 +01:00
|
|
|
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);
|
|
|
|
|
void seq_cache_thumbnail_put(const SeqRenderData *context,
|
|
|
|
|
Sequence *seq,
|
2021-09-21 10:38:15 +02:00
|
|
|
float timeline_frame,
|
2023-11-14 09:51:41 +01:00
|
|
|
ImBuf *i,
|
|
|
|
|
const rctf *view_area);
|
|
|
|
|
bool seq_cache_put_if_possible(
|
|
|
|
|
const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *nval);
|
2021-12-08 21:02:29 +11:00
|
|
|
/**
|
|
|
|
|
* Find only "base" keys.
|
|
|
|
|
* Sources(other types) for a frame must be freed all at once.
|
|
|
|
|
*/
|
2023-11-14 09:51:41 +01:00
|
|
|
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_all(Main *bmain);
|
|
|
|
|
void seq_cache_cleanup_sequence(Scene *scene,
|
|
|
|
|
Sequence *seq,
|
|
|
|
|
Sequence *seq_changed,
|
2020-12-19 05:57:27 +01:00
|
|
|
int invalidate_types,
|
|
|
|
|
bool force_seq_changed_range);
|
2021-09-21 10:38:15 +02:00
|
|
|
void seq_cache_thumbnail_cleanup(Scene *scene, rctf *view_area);
|
2023-11-14 09:51:41 +01:00
|
|
|
bool seq_cache_is_full();
|
|
|
|
|
float seq_cache_frame_index_to_timeline_frame(Sequence *seq, float frame_index);
|