Blender Git Loki

Git Commits -> Revision ce89355

Revision ce89355 by Sergey Sharybin (master)
December 13, 2013, 10:30 (GMT)
Image cache rewrite to using generic movie cache

Summary:
Behaves very much the same as cache for Movie Clip datablock:

- Image now have `MovieCache *cache` field which replaced
legacy `ListBase ibufs`.

This allows image datablock to easily keep of image
buffers which are owned by itself. This field isn't
saved to the file and getting restored on undo steps.

However, cache limit is global for movies, sequences
and image datablocks now. So overall cached image buffers
size will not go above cache limit size in user
preferences.

- Image buffers which are marked as BITMAPDIRTY will never
be freed from the cache.

- Added utility function to iterate over image buffers
saved in movie cache.

- Movie cache cleanup check callback now have ImBuf argument
which can be used in a condition of cleanup.

- Added some utility functions which replaces legacy ibufs
iterations with image cache iteration which happens from
inside a lock.

- Fixed `image_mem_size()` which was only counting one of
the buffers if both float and byte buffer present.

Additional notes:

- `BKE_image_get_first_ibuf()` is rather stupid, but direct
access to ibufs->first was also the same stupid idea.

Would consider avoid this function is another project.

- There are some places which doesn't look threadsafe, but
they already were not so much threadsafe anyway before.

So think not a big deal with solving this later.

Finally solves infinite memory usage by image sequences! :)

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: sebastian_k

Differential Revision: https://developer.blender.org/D95

Commit Details:

Full Hash: ce893552c359d11cfa93709f239a3c93f4cdb244
Parent Commit: 7eab49f
Lines Changed: +397, -223

14 Modified Paths:

/source/blender/blenkernel/BKE_image.h (+6, -0) (Diff)
/source/blender/blenkernel/intern/image.c (+280, -127) (Diff)
/source/blender/blenkernel/intern/seqcache.c (+1, -1) (Diff)
/source/blender/blenloader/intern/readfile.c (+6, -37) (Diff)
/source/blender/editors/sculpt_paint/paint_image.c (+9, -2) (Diff)
/source/blender/editors/sculpt_paint/paint_image_proj.c (+2, -2) (Diff)
/source/blender/editors/space_image/image_ops.c (+28, -12) (Diff)
/source/blender/editors/space_info/info_ops.c (+1, -1) (Diff)
/source/blender/gpu/intern/gpu_draw.c (+6, -2) (Diff)
/source/blender/imbuf/IMB_moviecache.h (+11, -1) (Diff)
/source/blender/imbuf/intern/moviecache.c (+36, -8) (Diff)
/source/blender/makesdna/DNA_image_types.h (+2, -1) (Diff)
/source/blender/makesrna/intern/rna_image.c (+4, -26) (Diff)
/source/blender/render/intern/source/imagetexture.c (+5, -3) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021