From 4a04f7206914a49f5f95adc5eb786237f1a9f547 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 23 Oct 2011 17:52:20 +0000 Subject: remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n --- source/blender/imbuf/intern/IMB_allocimbuf.h | 1 - source/blender/imbuf/intern/IMB_anim.h | 1 - source/blender/imbuf/intern/IMB_filetype.h | 2 - source/blender/imbuf/intern/IMB_filter.h | 1 - source/blender/imbuf/intern/IMB_indexer.h | 4 +- source/blender/imbuf/intern/IMB_metadata.h | 2 - source/blender/imbuf/intern/allocimbuf.c | 59 +--- source/blender/imbuf/intern/anim_movie.c | 1 - source/blender/imbuf/intern/bmp.c | 2 - source/blender/imbuf/intern/cache.c | 2 - source/blender/imbuf/intern/cineon/CMakeLists.txt | 1 - source/blender/imbuf/intern/cineon/cineon_dpx.c | 2 - source/blender/imbuf/intern/dds/BlockDXT.cpp | 2 - source/blender/imbuf/intern/dds/BlockDXT.h | 2 - source/blender/imbuf/intern/dds/CMakeLists.txt | 1 - source/blender/imbuf/intern/dds/Color.h | 2 - source/blender/imbuf/intern/dds/ColorBlock.cpp | 2 - source/blender/imbuf/intern/dds/ColorBlock.h | 2 - source/blender/imbuf/intern/dds/Common.h | 2 - .../blender/imbuf/intern/dds/DirectDrawSurface.cpp | 2 - .../blender/imbuf/intern/dds/DirectDrawSurface.h | 2 - source/blender/imbuf/intern/dds/Image.cpp | 2 - source/blender/imbuf/intern/dds/Image.h | 2 - source/blender/imbuf/intern/dds/PixelFormat.h | 2 - source/blender/imbuf/intern/dds/Stream.cpp | 2 - source/blender/imbuf/intern/dds/Stream.h | 2 - source/blender/imbuf/intern/dds/dds_api.cpp | 2 - source/blender/imbuf/intern/dds/dds_api.h | 2 - source/blender/imbuf/intern/divers.c | 2 - source/blender/imbuf/intern/filetype.c | 2 - source/blender/imbuf/intern/filter.c | 2 - source/blender/imbuf/intern/imageprocess.c | 2 - source/blender/imbuf/intern/imbuf.h | 1 - source/blender/imbuf/intern/imbuf_cocoa.m | 2 - source/blender/imbuf/intern/indexer.c | 8 +- source/blender/imbuf/intern/indexer_dv.c | 4 +- source/blender/imbuf/intern/iris.c | 4 - source/blender/imbuf/intern/jp2.c | 1 - source/blender/imbuf/intern/jpeg.c | 4 - source/blender/imbuf/intern/metadata.c | 2 - source/blender/imbuf/intern/module.c | 3 - source/blender/imbuf/intern/moviecache.c | 382 +++++++++++++++++++++ source/blender/imbuf/intern/openexr/CMakeLists.txt | 1 - source/blender/imbuf/intern/openexr/openexr_api.h | 2 - .../blender/imbuf/intern/openexr/openexr_multi.h | 2 - source/blender/imbuf/intern/png.c | 2 - source/blender/imbuf/intern/radiance_hdr.c | 6 +- source/blender/imbuf/intern/readimage.c | 2 - source/blender/imbuf/intern/rectop.c | 2 - source/blender/imbuf/intern/rotate.c | 2 - source/blender/imbuf/intern/scaling.c | 2 - source/blender/imbuf/intern/targa.c | 2 - source/blender/imbuf/intern/thumbs.c | 2 - source/blender/imbuf/intern/thumbs_blend.c | 2 - source/blender/imbuf/intern/tiff.c | 1 - source/blender/imbuf/intern/util.c | 2 - source/blender/imbuf/intern/writeimage.c | 2 - 57 files changed, 391 insertions(+), 169 deletions(-) create mode 100644 source/blender/imbuf/intern/moviecache.c (limited to 'source/blender/imbuf/intern') diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h index bfe53f30321..c2f1d2a1f51 100644 --- a/source/blender/imbuf/intern/IMB_allocimbuf.h +++ b/source/blender/imbuf/intern/IMB_allocimbuf.h @@ -1,7 +1,6 @@ /* * allocimbuf.h * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 05ba4b0d05f..5a410a6a583 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -1,7 +1,6 @@ /* * allocimbuf.h * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index cf0d0990d33..4cd10ad01d0 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/IMB_filter.h b/source/blender/imbuf/intern/IMB_filter.h index 0d414cb4702..a9e9e0ae776 100644 --- a/source/blender/imbuf/intern/IMB_filter.h +++ b/source/blender/imbuf/intern/IMB_filter.h @@ -1,7 +1,6 @@ /* * filter.h * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index 08fa51966f2..5c76f33a319 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -1,6 +1,4 @@ -/** - * $Id$ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/IMB_metadata.h b/source/blender/imbuf/intern/IMB_metadata.h index 723124bd2f5..0f57b8f654a 100644 --- a/source/blender/imbuf/intern/IMB_metadata.h +++ b/source/blender/imbuf/intern/IMB_metadata.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 6ce6c9409d1..1d82c862dbd 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -1,7 +1,6 @@ /* * allocimbuf.c * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -165,8 +164,9 @@ void IMB_freeImBuf(ImBuf *ibuf) IMB_freezbufImBuf(ibuf); IMB_freezbuffloatImBuf(ibuf); freeencodedbufferImBuf(ibuf); - IMB_cache_limiter_unmanage(ibuf); IMB_metadata_free(ibuf); + if (ibuf->dds_data.data != NULL) + free(ibuf->dds_data.data); MEM_freeN(ibuf); } } @@ -468,60 +468,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void) static MEM_CacheLimiterC *c = NULL; if(!c) - c = new_MEM_CacheLimiter(imbuf_cache_destructor); + c = new_MEM_CacheLimiter(imbuf_cache_destructor, NULL); return &c; } - -void IMB_free_cache_limiter(void) -{ - delete_MEM_CacheLimiter(*get_imbuf_cache_limiter()); - *get_imbuf_cache_limiter() = NULL; -} - -void IMB_cache_limiter_insert(ImBuf *i) -{ - if(!i->c_handle) { - i->c_handle = MEM_CacheLimiter_insert( - *get_imbuf_cache_limiter(), i); - MEM_CacheLimiter_ref(i->c_handle); - MEM_CacheLimiter_enforce_limits( - *get_imbuf_cache_limiter()); - MEM_CacheLimiter_unref(i->c_handle); - } -} - -void IMB_cache_limiter_unmanage(ImBuf *i) -{ - if(i->c_handle) { - MEM_CacheLimiter_unmanage(i->c_handle); - i->c_handle = NULL; - } -} - -void IMB_cache_limiter_touch(ImBuf *i) -{ - if(i->c_handle) - MEM_CacheLimiter_touch(i->c_handle); -} - -void IMB_cache_limiter_ref(ImBuf *i) -{ - if(i->c_handle) - MEM_CacheLimiter_ref(i->c_handle); -} - -void IMB_cache_limiter_unref(ImBuf *i) -{ - if(i->c_handle) - MEM_CacheLimiter_unref(i->c_handle); -} - -int IMB_cache_limiter_get_refcount(ImBuf *i) -{ - if(i->c_handle) - return MEM_CacheLimiter_get_refcount(i->c_handle); - - return 0; -} - diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 34c39b1083a..e1592d221fb 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1,7 +1,6 @@ /* * anim.c * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index bfec60245b8..a9c2d72b188 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c index 0b53c6bf79c..7213979b500 100644 --- a/source/blender/imbuf/intern/cache.c +++ b/source/blender/imbuf/intern/cache.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt index 4f7f20beecf..fdf4f5409a5 100644 --- a/source/blender/imbuf/intern/cineon/CMakeLists.txt +++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 8df2a9f6985..af964bb2bb3 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -27,7 +26,6 @@ * cineon.c * contributors: joeedh * I hearby donate this code and all rights to the Blender Foundation. - * $Id$ */ /** \file blender/imbuf/intern/cineon/cineon_dpx.c diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 0d17f16532b..2ea255234e5 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index aa0c1c509ca..cdf839ce9b4 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt index 53822b830f7..ae5f1ca9d09 100644 --- a/source/blender/imbuf/intern/dds/CMakeLists.txt +++ b/source/blender/imbuf/intern/dds/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h index 42ed34daf76..b23a5a32bdc 100644 --- a/source/blender/imbuf/intern/dds/Color.h +++ b/source/blender/imbuf/intern/dds/Color.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index edb69934231..b0c4d0a396e 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h index d4e4e8a809f..eb483f559c2 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.h +++ b/source/blender/imbuf/intern/dds/ColorBlock.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h index a6dcf69febf..8c307e346f0 100644 --- a/source/blender/imbuf/intern/dds/Common.h +++ b/source/blender/imbuf/intern/dds/Common.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 44e029bd7ce..3e017d5af82 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h index 5978e780991..8b8388c9f89 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp index b9ec1c0c3aa..6954030aaa2 100644 --- a/source/blender/imbuf/intern/dds/Image.cpp +++ b/source/blender/imbuf/intern/dds/Image.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h index 96e455fc75b..e932e1122f2 100644 --- a/source/blender/imbuf/intern/dds/Image.h +++ b/source/blender/imbuf/intern/dds/Image.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h index 35c6eacb972..c76c7994ed2 100644 --- a/source/blender/imbuf/intern/dds/PixelFormat.h +++ b/source/blender/imbuf/intern/dds/PixelFormat.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp index 497109efd25..00e1b679c69 100644 --- a/source/blender/imbuf/intern/dds/Stream.cpp +++ b/source/blender/imbuf/intern/dds/Stream.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h index ca081d331fe..1c789ac948f 100644 --- a/source/blender/imbuf/intern/dds/Stream.h +++ b/source/blender/imbuf/intern/dds/Stream.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 73ee3a2cb9c..b7a3d0e43ba 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h index d78e4f31474..e477a4b8003 100644 --- a/source/blender/imbuf/intern/dds/dds_api.h +++ b/source/blender/imbuf/intern/dds/dds_api.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 7fc7669601d..8c5f2dcafd6 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * allocimbuf.c * - * $Id$ */ /** \file blender/imbuf/intern/divers.c diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index c5121189952..c03736f4b0a 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 3719242aaba..479c7ed5626 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -1,6 +1,5 @@ /* * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -28,7 +27,6 @@ * ***** END GPL LICENSE BLOCK ***** * filter.c * - * $Id$ */ /** \file blender/imbuf/intern/filter.c diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 49f81edd4b2..9dad21aa728 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -39,7 +38,6 @@ * * april 95 * - * $Id$ */ #include diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h index 22481241812..c1afecf621f 100644 --- a/source/blender/imbuf/intern/imbuf.h +++ b/source/blender/imbuf/intern/imbuf.h @@ -3,7 +3,6 @@ * * This header might have to become external... * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m index 9b627612d2a..7005558d753 100644 --- a/source/blender/imbuf/intern/imbuf_cocoa.m +++ b/source/blender/imbuf/intern/imbuf_cocoa.m @@ -1,7 +1,5 @@ /* * imbuf_coca.m - * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index e4abd8b329d..3a94c79f48d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1,12 +1,10 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,7 +20,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -*/ + */ #include "IMB_indexer.h" #include "IMB_anim.h" @@ -454,7 +452,7 @@ static int round_up(int x, int mod) static struct proxy_output_ctx * alloc_proxy_output_ffmpeg( struct anim * anim, AVStream * st, int proxy_size, int width, int height, - int quality) + int UNUSED(quality)) { struct proxy_output_ctx * rv = MEM_callocN( sizeof(struct proxy_output_ctx), "alloc_proxy_output"); diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index aa258a6b9ee..4ccd8ec464d 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -22,7 +20,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -*/ + */ #include "IMB_indexer.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index c6aaf336fb7..cf7337a574b 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -24,9 +23,6 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * iris.c - * - * $Id$ */ /** \file blender/imbuf/intern/iris.c diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 4872896bf3a..151933d6651 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 53d4a403190..d9bd0b9cda4 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -24,9 +23,6 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * jpeg.c - * - * $Id$ */ /** \file blender/imbuf/intern/jpeg.c diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c index 9faab6eec48..e6b6e9aa238 100644 --- a/source/blender/imbuf/intern/metadata.c +++ b/source/blender/imbuf/intern/metadata.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/module.c b/source/blender/imbuf/intern/module.c index f732500b82e..55a29333620 100644 --- a/source/blender/imbuf/intern/module.c +++ b/source/blender/imbuf/intern/module.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -39,7 +37,6 @@ void IMB_init(void) void IMB_exit(void) { - IMB_free_cache_limiter(); imb_tile_cache_exit(); imb_filetypes_exit(); } diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c new file mode 100644 index 00000000000..7492b6aec44 --- /dev/null +++ b/source/blender/imbuf/intern/moviecache.c @@ -0,0 +1,382 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + * + * Contributor(s): Blender Foundation, + * Sergey Sharybin, + * Peter Schlaile + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/moviecache.c + * \ingroup bke + */ + +#include /* for qsort */ +#include + +#include "MEM_guardedalloc.h" +#include "MEM_CacheLimiterC-Api.h" + +#include "BLI_utildefines.h" +#include "BLI_ghash.h" +#include "BLI_mempool.h" + +#include "IMB_moviecache.h" + +#include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" + +static MEM_CacheLimiterC *limitor= NULL; + +typedef struct MovieCache { + GHash *hash; + GHashHashFP hashfp; + GHashCmpFP cmpfp; + MovieCacheGetKeyDataFP getdatafp; + + struct BLI_mempool *keys_pool; + struct BLI_mempool *items_pool; + struct BLI_mempool *userkeys_pool; + + int keysize; + unsigned long curtime; + + int totseg, *points, proxy, render_flags; /* for visual statistics optimization */ + int pad; +} MovieCache; + +typedef struct MovieCacheKey { + MovieCache *cache_owner; + void *userkey; +} MovieCacheKey; + +typedef struct MovieCacheItem { + MovieCache *cache_owner; + ImBuf *ibuf; + MEM_CacheLimiterHandleC * c_handle; + unsigned long last_access; +} MovieCacheItem; + +static unsigned int moviecache_hashhash(const void *keyv) +{ + MovieCacheKey *key= (MovieCacheKey*)keyv; + + return key->cache_owner->hashfp(key->userkey); +} + +static int moviecache_hashcmp(const void *av, const void *bv) +{ + const MovieCacheKey *a= (MovieCacheKey*)av; + const MovieCacheKey *b= (MovieCacheKey*)bv; + + return a->cache_owner->cmpfp(a->userkey, b->userkey); +} + +static void moviecache_keyfree(void *val) +{ + MovieCacheKey *key= (MovieCacheKey*)val; + + BLI_mempool_free(key->cache_owner->keys_pool, key); +} + +static void moviecache_valfree(void *val) +{ + MovieCacheItem *item= (MovieCacheItem*)val; + + if (item->ibuf) { + MEM_CacheLimiter_unmanage(item->c_handle); + IMB_freeImBuf(item->ibuf); + } + + BLI_mempool_free(item->cache_owner->items_pool, item); +} + +static void check_unused_keys(MovieCache *cache) +{ + GHashIterator *iter; + + iter= BLI_ghashIterator_new(cache->hash); + while(!BLI_ghashIterator_isDone(iter)) { + MovieCacheKey *key= BLI_ghashIterator_getKey(iter); + MovieCacheItem *item= BLI_ghashIterator_getValue(iter); + + BLI_ghashIterator_step(iter); + + if(!item->ibuf) + BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree); + } + + BLI_ghashIterator_free(iter); +} + +static int compare_int(const void *av, const void *bv) +{ + const int *a= (int *)av; + const int *b= (int *)bv; + return *a-*b; +} + +static void IMB_moviecache_destructor(void *p) +{ + MovieCacheItem *item= (MovieCacheItem *) p; + + if (item && item->ibuf) { + IMB_freeImBuf(item->ibuf); + + item->ibuf= NULL; + item->c_handle= NULL; + } +} + +/* approximate size of ImBuf in memory */ +static intptr_t IMB_get_size_in_memory(ImBuf *ibuf) +{ + int a; + intptr_t size= 0, channel_size= 0; + + size+= sizeof(ImBuf); + + if(ibuf->rect) + channel_size+= sizeof(char); + + if(ibuf->rect_float) + channel_size+= sizeof(float); + + size+= channel_size*ibuf->x*ibuf->y*ibuf->channels; + + if(ibuf->miptot) { + for(a= 0; amiptot; a++) { + if(ibuf->mipmap[a]) + size+= IMB_get_size_in_memory(ibuf->mipmap[a]); + } + } + + if(ibuf->tiles) { + size+= sizeof(unsigned int)*ibuf->ytiles*ibuf->xtiles; + } + + return size; +} + +static intptr_t get_item_size (void *p) +{ + intptr_t size= sizeof(MovieCacheItem); + MovieCacheItem *item= (MovieCacheItem *) p; + + if(item->ibuf) + size+= IMB_get_size_in_memory(item->ibuf); + + return size; +} + +void IMB_moviecache_init(void) +{ + limitor= new_MEM_CacheLimiter(IMB_moviecache_destructor, get_item_size); +} + +void IMB_moviecache_destruct(void) +{ + if(limitor) + delete_MEM_CacheLimiter(limitor); +} + +struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp, + MovieCacheGetKeyDataFP getdatafp) +{ + MovieCache *cache; + + cache= MEM_callocN(sizeof(MovieCache), "MovieCache"); + cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, 0); + cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, 0); + cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, 0); + cache->hash= BLI_ghash_new(moviecache_hashhash, moviecache_hashcmp, "MovieClip ImBuf cache hash"); + + cache->keysize= keysize; + cache->hashfp= hashfp; + cache->cmpfp= cmpfp; + cache->getdatafp= getdatafp; + cache->proxy= -1; + + return cache; +} + +void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf) +{ + MovieCacheKey *key; + MovieCacheItem *item; + + if(!limitor) + IMB_moviecache_init(); + + IMB_refImBuf(ibuf); + + key= BLI_mempool_alloc(cache->keys_pool); + key->cache_owner= cache; + key->userkey= BLI_mempool_alloc(cache->userkeys_pool);; + memcpy(key->userkey, userkey, cache->keysize); + + item= BLI_mempool_alloc(cache->items_pool); + item->ibuf= ibuf; + item->cache_owner= cache; + item->last_access= cache->curtime++; + item->c_handle= NULL; + + BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree); + BLI_ghash_insert(cache->hash, key, item); + + item->c_handle= MEM_CacheLimiter_insert(limitor, item); + + MEM_CacheLimiter_ref(item->c_handle); + MEM_CacheLimiter_enforce_limits(limitor); + MEM_CacheLimiter_unref(item->c_handle); + + /* cache limiter can't remove unused keys which points to destoryed values */ + check_unused_keys(cache); + + if(cache->points) { + MEM_freeN(cache->points); + cache->points= NULL; + } +} + +ImBuf* IMB_moviecache_get(MovieCache *cache, void *userkey) +{ + MovieCacheKey key; + MovieCacheItem *item; + + key.cache_owner= cache; + key.userkey= userkey; + item= (MovieCacheItem*)BLI_ghash_lookup(cache->hash, &key); + + if(item) { + item->last_access= cache->curtime++; + + if(item->ibuf) { + MEM_CacheLimiter_touch(item->c_handle); + IMB_refImBuf(item->ibuf); + + return item->ibuf; + } + } + + return NULL; +} + +void IMB_moviecache_free(MovieCache *cache) +{ + BLI_ghash_free(cache->hash, moviecache_keyfree, moviecache_valfree); + + BLI_mempool_destroy(cache->keys_pool); + BLI_mempool_destroy(cache->items_pool); + BLI_mempool_destroy(cache->userkeys_pool); + + if(cache->points) + MEM_freeN(cache->points); + + MEM_freeN(cache); +} + +/* get segments of cached frames. useful for debugging cache policies */ +void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r) +{ + *totseg_r= 0; + *points_r= NULL; + + if(!cache->getdatafp) + return; + + if(cache->proxy!=proxy || cache->render_flags!=render_flags) { + if(cache->points) + MEM_freeN(cache->points); + + cache->points= NULL; + } + + if(cache->points) { + *totseg_r= cache->totseg; + *points_r= cache->points; + } else { + int totframe= BLI_ghash_size(cache->hash); + int *frames= MEM_callocN(totframe*sizeof(int), "movieclip cache frames"); + int a, totseg= 0; + GHashIterator *iter; + + iter= BLI_ghashIterator_new(cache->hash); + a= 0; + while(!BLI_ghashIterator_isDone(iter)) { + MovieCacheKey *key= BLI_ghashIterator_getKey(iter); + MovieCacheItem *item= BLI_ghashIterator_getValue(iter); + int framenr, curproxy, curflags; + + if(item->ibuf) { + cache->getdatafp(key->userkey, &framenr, &curproxy, &curflags); + + if(curproxy==proxy && curflags==render_flags) + frames[a++]= framenr; + } + + BLI_ghashIterator_step(iter); + } + + BLI_ghashIterator_free(iter); + + qsort(frames, totframe, sizeof(int), compare_int); + + /* count */ + for(a= 0; atotseg= totseg; + cache->points= points; + cache->proxy= proxy; + cache->render_flags= render_flags; + } + + MEM_freeN(frames); + } +} diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index 3be5219ae44..4ee2ff4cc47 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index 55aea13950e..8567673a3e3 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 58c5e0f2a3e..abb675e1dca 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index f0c06ec0ae7..13c381ae9c4 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -24,7 +23,6 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * $Id$ */ /** \file blender/imbuf/intern/png.c diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 9dd330ca88b..ec63a93ac69 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -1,8 +1,4 @@ /* - * radiance_hdr.c - * - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -27,7 +23,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -*/ + */ /** \file blender/imbuf/intern/radiance_hdr.c * \ingroup imbuf diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 1c1e681bb30..794777b21d3 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * allocimbuf.c * - * $Id$ */ /** \file blender/imbuf/intern/readimage.c diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index db2ae3a5114..97b94ae7b27 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * allocimbuf.c * - * $Id$ */ /** \file blender/imbuf/intern/rectop.c diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c index 2f9d5d60baa..7ca7445569f 100644 --- a/source/blender/imbuf/intern/rotate.c +++ b/source/blender/imbuf/intern/rotate.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * rotate.c * - * $Id$ */ /** \file blender/imbuf/intern/rotate.c diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 5389d90867e..fe53a883f82 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * allocimbuf.c * - * $Id$ */ /** \file blender/imbuf/intern/scaling.c diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index c757b435d90..2efed56ac2c 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -24,7 +23,6 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * $Id$ */ /** \file blender/imbuf/intern/targa.c diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index d2bf7f75615..ffe255ab9eb 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 03c80787920..0eaa87542d5 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index ccb271393a4..d9580961cf5 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -1,7 +1,6 @@ /* * tiff.c * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 85d31f18a03..872b78743be 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * util.c * - * $Id$ */ /** \file blender/imbuf/intern/util.c diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index b933e6d93ee..8fbed6da32b 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -1,5 +1,4 @@ /* - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * writeimage.c * - * $Id$ */ /** \file blender/imbuf/intern/writeimage.c -- cgit v1.2.3