Page MenuHome

Fix T81751: use the system-memory preference for animation playback cache limiting
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on May 5 2021, 1:37 PM.

Details

Summary

Currently the the animation players cache is hard coded to 30 frames (which is quite low).

This causes larger files that take longer to load to become unplayable as they never load into memory and there is no way of allowing them to load into memory.

This change uses the system preference to limit caching by memory instead of number of frames.

This makes it possible to for the files in T81751 to playback smoothly.


There are details that could be changed in this patch, this is a quick test to see if it's a direction worth going.

  • This could be a separate preference exposed in the animation-player section of the UI, as users might not want this limit to be used twice (possibly using double the intended memory).
  • In the test files in T81751, frame skipping prevents images from being loaded into cache, causing multiple loops to be played before all images load and playback is smooth.

    Frame skipping could be disabled as long as cache is being filled, although I think this is outside the scope of this patch.

We could put these kinds of changes on-hold as the entire system could use bigger improvements, threaded image loading for e.g, although even in this case the ability to keep more images in cache seems reasonable.

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 14399
Build 14399: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.May 5 2021, 1:37 PM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) retitled this revision from Apply system memory limit to animation player to Fix T81751: use the system-memory preference for animation playback cache limiting.May 5 2021, 1:45 PM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Store the amount of memory in bytes to simplify applying the memory limit
Sergey Sharybin (sergey) requested changes to this revision.May 5 2021, 2:21 PM

This caching should really be implemented using MovieCache. It will give you all the functionality needed to support memory limits on a random frame access. I don't think it will take you longer to use MovieCache than re-implementing the limiting logic in the player.

source/blender/windowmanager/intern/wm_playanim.c
1237–1238

const int memory_in_mb = max(0, atoi(argv[2]));

1462

Use IMB_get_size_in_memory() to more accurately estimate size of the cache.

source/creator/creator_args.c
1194

Mention that 0 disables the limit.

This revision now requires changes to proceed.May 5 2021, 2:21 PM
  • Use image buffer size instead of MEM_get_memory_in_use
  • Minor change for memory clamping.
  • Note that zero disables caching