diff --git a/ChangeLog b/ChangeLog index 947d1abc..264daf95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,7 @@ - added @container option to dzsave - support 1/2/4 bit palette tiff images with alpha - vips_system() now uses g_spawn_command_line_sync() +- added im_tile_cache_random() to help nip2 6/3/14 started 7.38.6 - grey ramp minimum was wrong diff --git a/TODO b/TODO index 2c49d218..d8d4cbd5 100644 --- a/TODO +++ b/TODO @@ -3,27 +3,6 @@ - -- why is cache in nip2 so slow? its awful - - investigate again - - is it using vips_sinkscreen()? should it use tilecache? - - Cache calls cache in _stdenv.def - - cache calls im_cache() - - im_cache() calls vips_sink_screen() - - - - im_tile_cache() calls vips_tilecache() - - add im_tile_cache to vips7 op db, try using it from nip2 - - - - test draw_mask on labq images we probably need to unpack the ink back to double before blending diff --git a/libvips/deprecated/package.c b/libvips/deprecated/package.c index dd43802a..29332809 100644 --- a/libvips/deprecated/package.c +++ b/libvips/deprecated/package.c @@ -497,26 +497,24 @@ static im_function cache_desc = { cache_args /* Arg list */ }; -/* Call im_tile_cache() via arg vector. - */ static int -tile_cache_vec( im_object *argv ) +tile_cache_random_vec( im_object *argv ) { int tile_width = *((int *) argv[2]); int tile_height = *((int *) argv[3]); int max_tiles = *((int *) argv[4]); - return( im_tile_cache( argv[0], argv[1], + return( im_tile_cache_random( argv[0], argv[1], tile_width, tile_height, max_tiles ) ); } /* Description of im_cache. */ -static im_function tile_cache_desc = { - "im_tile_cache", /* Name */ +static im_function tile_cache_random_desc = { + "im_tile_cache_random", /* Name */ "cache results of an operation",/* Description */ 0, /* Flags */ - tile_cache_vec, /* Dispatch function */ + tile_cache_random_vec, /* Dispatch function */ VIPS_NUMBER( cache_args ), /* Size of arg list */ cache_args /* Arg list */ }; @@ -570,7 +568,7 @@ static im_function binfile_desc = { static im_function *iofuncs_list[] = { &binfile_desc, &cache_desc, - &tile_cache_desc, + &tile_cache_random_desc, &concurrency_get_desc, &getext_desc, &guess_prefix_desc, diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 0ccb452a..48d322ed 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -4450,6 +4450,34 @@ im_tile_cache( IMAGE *in, IMAGE *out, return( 0 ); } +/* This is the one used by nip2's menu for caching images. Random access and + * persistent. + */ +int +im_tile_cache_random( IMAGE *in, IMAGE *out, + int tile_width, int tile_height, int max_tiles ) +{ + VipsImage *x; + + if( vips_tilecache( in, &x, + "tile_width", tile_width, + "tile_height", tile_height, + "max_tiles", max_tiles, + "access", VIPS_ACCESS_RANDOM, + "persistent", TRUE, + "threaded", TRUE, + NULL ) ) + return( -1 ); + + if( im_copy( x, out ) ) { + g_object_unref( x ); + return( -1 ); + } + g_object_unref( x ); + + return( 0 ); +} + static int im__affinei( VipsImage *in, VipsImage *out, VipsInterpolate *interpolate, VipsTransformation *trn ) diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 515f3f0a..d21b8096 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -777,6 +777,9 @@ int im_argb2rgba( VipsImage *in, VipsImage *out ); int im_falsecolour( VipsImage *in, VipsImage *out ); int im_gammacorrect( VipsImage *in, VipsImage *out, double exponent ); +int im_tile_cache_random( IMAGE *in, IMAGE *out, + int tile_width, int tile_height, int max_tiles ); + int im_shrink( VipsImage *in, VipsImage *out, double xshrink, double yshrink ); int im_affinei( VipsImage *in, VipsImage *out, VipsInterpolate *interpolate,