Merge remote-tracking branch 'origin/7.32'
This commit is contained in:
commit
147b135944
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
16/4/13 started 7.32.3
|
16/4/13 started 7.32.3
|
||||||
- rename GETTEXT_PACKAGE as vips7.32 to help Debian (thanks Jay)
|
- rename GETTEXT_PACKAGE as vips7.32 to help Debian (thanks Jay)
|
||||||
|
- added "persistent" option to tilecache
|
||||||
|
|
||||||
12/3/13 started 7.32.2
|
12/3/13 started 7.32.2
|
||||||
- removed some left-over debugging code from configure.ac
|
- removed some left-over debugging code from configure.ac
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
* - make it optionally threaded
|
* - make it optionally threaded
|
||||||
* 21/2/13
|
* 21/2/13
|
||||||
* - could deadlock if downstream raised an error (thanks Todd)
|
* - could deadlock if downstream raised an error (thanks Todd)
|
||||||
|
* 25/4/13
|
||||||
|
* - cache minimisation is optional, see "persistent" flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -119,6 +121,7 @@ typedef struct _VipsBlockCache {
|
|||||||
int max_tiles;
|
int max_tiles;
|
||||||
VipsCacheStrategy strategy;
|
VipsCacheStrategy strategy;
|
||||||
gboolean threaded;
|
gboolean threaded;
|
||||||
|
gboolean persistent;
|
||||||
|
|
||||||
int time; /* Update ticks for LRU here */
|
int time; /* Update ticks for LRU here */
|
||||||
int ntiles; /* Current cache size */
|
int ntiles; /* Current cache size */
|
||||||
@ -290,13 +293,18 @@ vips_tile_find( VipsBlockCache *cache, int x, int y )
|
|||||||
|
|
||||||
/* In cache already?
|
/* In cache already?
|
||||||
*/
|
*/
|
||||||
if( (tile = vips_tile_search( cache, x, y )) )
|
if( (tile = vips_tile_search( cache, x, y )) ) {
|
||||||
|
VIPS_DEBUG_MSG( "vips_tile_find: tile %d x %d in cache\n",
|
||||||
|
x, y );
|
||||||
return( tile );
|
return( tile );
|
||||||
|
}
|
||||||
|
|
||||||
/* VipsBlockCache not full?
|
/* VipsBlockCache not full?
|
||||||
*/
|
*/
|
||||||
if( cache->max_tiles == -1 ||
|
if( cache->max_tiles == -1 ||
|
||||||
cache->ntiles < cache->max_tiles ) {
|
cache->ntiles < cache->max_tiles ) {
|
||||||
|
VIPS_DEBUG_MSG( "vips_tile_find: making new tile at %d x %d\n",
|
||||||
|
x, y );
|
||||||
if( !(tile = vips_tile_new( cache, x, y )) )
|
if( !(tile = vips_tile_new( cache, x, y )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
@ -363,8 +371,9 @@ vips_block_cache_build( VipsObject *object )
|
|||||||
build( object ) )
|
build( object ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
g_signal_connect( conversion->out, "minimise",
|
if( !cache->persistent )
|
||||||
G_CALLBACK( vips_block_cache_minimise ), cache );
|
g_signal_connect( conversion->out, "minimise",
|
||||||
|
G_CALLBACK( vips_block_cache_minimise ), cache );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -401,6 +410,13 @@ vips_block_cache_class_init( VipsBlockCacheClass *class )
|
|||||||
G_STRUCT_OFFSET( VipsBlockCache, tile_height ),
|
G_STRUCT_OFFSET( VipsBlockCache, tile_height ),
|
||||||
1, 1000000, 128 );
|
1, 1000000, 128 );
|
||||||
|
|
||||||
|
VIPS_ARG_ENUM( class, "strategy", 6,
|
||||||
|
_( "Strategy" ),
|
||||||
|
_( "Expected access pattern" ),
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsBlockCache, strategy ),
|
||||||
|
VIPS_TYPE_CACHE_STRATEGY, VIPS_CACHE_RANDOM );
|
||||||
|
|
||||||
VIPS_ARG_BOOL( class, "threaded", 7,
|
VIPS_ARG_BOOL( class, "threaded", 7,
|
||||||
_( "Threaded" ),
|
_( "Threaded" ),
|
||||||
_( "Allow threaded access" ),
|
_( "Allow threaded access" ),
|
||||||
@ -408,12 +424,12 @@ vips_block_cache_class_init( VipsBlockCacheClass *class )
|
|||||||
G_STRUCT_OFFSET( VipsBlockCache, threaded ),
|
G_STRUCT_OFFSET( VipsBlockCache, threaded ),
|
||||||
FALSE );
|
FALSE );
|
||||||
|
|
||||||
VIPS_ARG_ENUM( class, "strategy", 6,
|
VIPS_ARG_BOOL( class, "persistent", 8,
|
||||||
_( "Strategy" ),
|
_( "Persistent" ),
|
||||||
_( "Expected access pattern" ),
|
_( "Keep cache between evaluations" ),
|
||||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
G_STRUCT_OFFSET( VipsBlockCache, strategy ),
|
G_STRUCT_OFFSET( VipsBlockCache, persistent ),
|
||||||
VIPS_TYPE_CACHE_STRATEGY, VIPS_CACHE_RANDOM );
|
FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
@ -442,6 +458,9 @@ vips_tile_destroy( VipsTile *tile )
|
|||||||
{
|
{
|
||||||
VipsBlockCache *cache = tile->cache;
|
VipsBlockCache *cache = tile->cache;
|
||||||
|
|
||||||
|
VIPS_DEBUG_MSG( "vips_tile_destroy: tile %d, %d (%p)\n",
|
||||||
|
tile->pos.left, tile->pos.top, tile );
|
||||||
|
|
||||||
cache->ntiles -= 1;
|
cache->ntiles -= 1;
|
||||||
g_assert( cache->ntiles >= 0 );
|
g_assert( cache->ntiles >= 0 );
|
||||||
tile->cache = NULL;
|
tile->cache = NULL;
|
||||||
@ -459,6 +478,7 @@ vips_block_cache_init( VipsBlockCache *cache )
|
|||||||
cache->max_tiles = 1000;
|
cache->max_tiles = 1000;
|
||||||
cache->strategy = VIPS_CACHE_RANDOM;
|
cache->strategy = VIPS_CACHE_RANDOM;
|
||||||
cache->threaded = FALSE;
|
cache->threaded = FALSE;
|
||||||
|
cache->persistent = FALSE;
|
||||||
|
|
||||||
cache->time = 0;
|
cache->time = 0;
|
||||||
cache->ntiles = 0;
|
cache->ntiles = 0;
|
||||||
@ -781,6 +801,7 @@ vips_tile_cache_init( VipsTileCache *cache )
|
|||||||
* @max_tiles: maximum number of tiles to cache
|
* @max_tiles: maximum number of tiles to cache
|
||||||
* @strategy: hint expected access pattern #VipsCacheStrategy
|
* @strategy: hint expected access pattern #VipsCacheStrategy
|
||||||
* @threaded: allow many threads
|
* @threaded: allow many threads
|
||||||
|
* @persistent: don't drop cache at end of computation
|
||||||
*
|
*
|
||||||
* This operation behaves rather like vips_copy() between images
|
* This operation behaves rather like vips_copy() between images
|
||||||
* @in and @out, except that it keeps a cache of computed pixels.
|
* @in and @out, except that it keeps a cache of computed pixels.
|
||||||
@ -802,6 +823,9 @@ vips_tile_cache_init( VipsTileCache *cache )
|
|||||||
* you set @threaded to %TRUE, vips_tilecache() will allow many threads to
|
* you set @threaded to %TRUE, vips_tilecache() will allow many threads to
|
||||||
* calculate tiles at once, and share the cache between them.
|
* calculate tiles at once, and share the cache between them.
|
||||||
*
|
*
|
||||||
|
* Normally the cache is dropped when computation finishes. Set @persistent to
|
||||||
|
* %TRUE to keep the cache between computations.
|
||||||
|
*
|
||||||
* See also: vips_cache(), vips_linecache().
|
* See also: vips_cache(), vips_linecache().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 on error.
|
* Returns: 0 on success, -1 on error.
|
||||||
|
@ -1039,7 +1039,7 @@ mask_fill( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
|
|||||||
* vips_region_prepare() on @out will always block until the pixels have been
|
* vips_region_prepare() on @out will always block until the pixels have been
|
||||||
* calculated.
|
* calculated.
|
||||||
*
|
*
|
||||||
* See also: vips_image_cache(), im_tile_cache(), vips_region_prepare(),
|
* See also: vips_tilecache(), vips_region_prepare(),
|
||||||
* vips_sink_disc(), vips_sink().
|
* vips_sink_disc(), vips_sink().
|
||||||
*
|
*
|
||||||
* Returns: 0 on sucess, -1 on error.
|
* Returns: 0 on sucess, -1 on error.
|
||||||
|
Loading…
Reference in New Issue
Block a user