Sequencer cache
Overview:
Structure of this cache was modified to allow implementation of "image dumping" (replacement of non-movie proxies) and Prefetching. This means, that sequencer cache no longer uses IMB_moviecache API, but its own. This will duplicate some functionality, wont't introduce unnecessary complexity to IMB_moviecache.
Each Scene owns single sequencer cache.
This cache should be viewed as "3D" space for stored images:
- each frame of timeline can be cached
- frame is composed of number of strips, that can be cached individually
- each strip has number of rendering stages that can be cached
Cached stages
- SEQ_CACHE_RAW Image as provided by input codec / read from disk.
- SEQ_CACHE_PREPROCESSED: Image after scaling and color transformations applied, ...
- SEQ_CACHE_COMPOSITE: Intermediate composited images(blended with another strips)
- SEQ_CACHE_FINAL_OUT: Final image for each frame. This is a copy of last(topmost) strip composite image, so if both cached, memory usage is about the same as if only 1 of them is cached
Image cost
Each stored image has a cost assigned. Cost is calculated as ratio of time spent on rendering to maximum possible time to keep up with chosen frame rate. The higher the cost, the harder it is to render image.
Maximum image cost is limited to arbitrary value of 10
Cache size limiting
When cache is full, all images of most distant frame from playhead are removed. Modifying property "Recycle Up To Cost" recycle_max_cost can prevent removal of expensive frames, "locking" them in memory.
Temporary cache
Sometimes it is required to use single image multiple times to render single frame. To prevent unnecessary re-rendering, all stages of rendering are stored in cache until the frame is rendered completely and some(depending on storage configuration) are removed before next frame is rendered.
This means, that you can modify topmost strip in stack without need to re-render all strips leading to faster update rate in some cases
Dependency
To ensure, that stages chosen by user are always cached, a dependency system is used. To achieve this, when removing an image from cache we also have to remove all images that were created using this image.
Currently, when image is invalidated we remove the whole frame.
Memory visualization
Stored images can be visualized directly on timeline by setting "Show Cache" show_cache and show_cache_TYPE property to True
Configuration / RNA API
show_cache - Visualize cached images on the timeline
show_cache_TYPE - Visualize TYPE on timeline
cache_TYPE - Enable storage of TYPE
recycle_max_cost - Only frames with cost lower than this value will be recycled
override_cache_settings - Override global cache settings(per sequence)
sequence_editor properties
- show_cache
- show_cache_final_out
- show_cache_raw
- show_cache_preprocessed
- show_cache_composite
- cache_raw
- cache_preprocessed
- cache_composite
- cache_final
- recycle_max_cost
sequence properties
- cache_raw
- cache_preprocessed
- cache_composite
- override_cache_settings