various small bugfixes
now works
This commit is contained in:
parent
199c182103
commit
d0b1740fd1
@ -1,5 +1,7 @@
|
||||
3/10/12 started 7.31.0
|
||||
- dzsave can write zoomify and google maps layout as well
|
||||
- openslide2vips now opens the input once for each thread
|
||||
- tilecache supports threaded access
|
||||
|
||||
2/10/12 started 7.30.4
|
||||
- remove options from format string in .dzi (thanks Martin)
|
||||
|
@ -123,7 +123,6 @@ vips_conversion_operation_init( void )
|
||||
extern GType vips_recomb_get_type( void );
|
||||
extern GType vips_bandmean_get_type( void );
|
||||
extern GType vips_flatten_get_type( void );
|
||||
extern GType vips_thread_cache_get_type( void );
|
||||
|
||||
vips_copy_get_type();
|
||||
vips_tile_cache_get_type();
|
||||
@ -145,7 +144,6 @@ vips_conversion_operation_init( void )
|
||||
vips_recomb_get_type();
|
||||
vips_bandmean_get_type();
|
||||
vips_flatten_get_type();
|
||||
vips_thread_cache_get_type();
|
||||
}
|
||||
|
||||
/* The common part of most binary conversion
|
||||
|
@ -155,9 +155,8 @@ vips_sequential_generate( VipsRegion *or,
|
||||
* either not read anything yet or fallen through from the stall
|
||||
* above.
|
||||
*
|
||||
* Probably the operation is something like
|
||||
* extract_area and we should skip the initial part of the image. In
|
||||
* fact we read to cache.
|
||||
* Probably the operation is something like extract_area and we should
|
||||
* skip the initial part of the image. In fact, we read to cache.
|
||||
*/
|
||||
if( r->top > sequential->y_pos ) {
|
||||
VipsRect area;
|
||||
|
@ -404,6 +404,7 @@ vips_block_cache_class_init( VipsBlockCacheClass *class )
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
|
||||
VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
|
||||
VipsOperationClass *operation_class = VIPS_OPERATION_CLASS( class );
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_block_cache_class_init\n" );
|
||||
|
||||
@ -415,27 +416,29 @@ vips_block_cache_class_init( VipsBlockCacheClass *class )
|
||||
vobject_class->description = _( "cache an image" );
|
||||
vobject_class->build = vips_block_cache_build;
|
||||
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsBlockCache, in ) );
|
||||
|
||||
VIPS_ARG_INT( class, "tile_height", 3,
|
||||
VIPS_ARG_INT( class, "tile_height", 4,
|
||||
_( "Tile height" ),
|
||||
_( "Tile height in pixels" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsBlockCache, tile_height ),
|
||||
1, 1000000, 128 );
|
||||
|
||||
VIPS_ARG_BOOL( class, "threaded", 3,
|
||||
VIPS_ARG_BOOL( class, "threaded", 7,
|
||||
_( "Threaded" ),
|
||||
_( "Allow threaded access" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsBlockCache, threaded ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_ENUM( class, "strategy", 3,
|
||||
VIPS_ARG_ENUM( class, "strategy", 6,
|
||||
_( "Strategy" ),
|
||||
_( "Expected access pattern" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
@ -546,7 +549,11 @@ vips_tile_cache_ref( VipsBlockCache *cache, VipsRect *r )
|
||||
}
|
||||
|
||||
tile->ref_count += 1;
|
||||
work = g_slist_prepend( work, tile );
|
||||
|
||||
/* We must append, since we want to keep tile ordering
|
||||
* for sequential sources.
|
||||
*/
|
||||
work = g_slist_append( work, tile );
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_tile_cache_gen: "
|
||||
"tile %d, %d (%p)\n", x, y, tile );
|
||||
@ -726,7 +733,7 @@ vips_tile_cache_class_init( VipsTileCacheClass *class )
|
||||
G_STRUCT_OFFSET( VipsBlockCache, tile_width ),
|
||||
1, 1000000, 128 );
|
||||
|
||||
VIPS_ARG_INT( class, "max_tiles", 3,
|
||||
VIPS_ARG_INT( class, "max_tiles", 5,
|
||||
_( "Max tiles" ),
|
||||
_( "Maximum number of tiles to cache" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -84,6 +84,9 @@
|
||||
|
||||
/* We run our own tile cache. The OpenSlide one can't always keep enough for a
|
||||
* complete lines of pixels.
|
||||
*
|
||||
* These numbers need to align with the tiles used in the underlying openslide
|
||||
* image. We need to add something to openslide to output this data.
|
||||
*/
|
||||
#define TILE_WIDTH (256)
|
||||
#define TILE_HEIGHT (256)
|
||||
@ -122,6 +125,7 @@ vips__openslide_isslide( const char *filename )
|
||||
if( vendor &&
|
||||
strcmp( vendor, "generic-tiff" ) != 0 )
|
||||
ok = 1;
|
||||
|
||||
openslide_close( osr );
|
||||
}
|
||||
|
||||
@ -324,11 +328,11 @@ vips__openslide_generate( VipsRegion *out,
|
||||
|
||||
/* We're inside a cache, so requests should always be TILE_WIDTH by
|
||||
* TILE_HEIGHT pixels and on a tile boundary.
|
||||
*/
|
||||
g_assert( (r->left % TILE_WIDTH) == 0 );
|
||||
g_assert( (r->height % TILE_HEIGHT) == 0 );
|
||||
g_assert( (r->top % TILE_HEIGHT) == 0 );
|
||||
g_assert( r->width <= TILE_WIDTH );
|
||||
g_assert( r->height <= TILE_HEIGHT );
|
||||
*/
|
||||
|
||||
openslide_read_region( seq->osr,
|
||||
seq->buf,
|
||||
@ -347,13 +351,14 @@ vips__openslide_generate( VipsRegion *out,
|
||||
|
||||
/* Convert from ARGB to RGBA and undo premultiplication.
|
||||
*/
|
||||
for( p = seq->buf, y = 0; y < r->height; p += r->width, y++ ) {
|
||||
p = seq->buf;
|
||||
for( y = 0; y < r->height; y++ ) {
|
||||
VipsPel *q = (VipsPel *)
|
||||
VIPS_REGION_ADDR( out, r->left, r->top + y );
|
||||
|
||||
for( x = 0; x < r->width; x++ ) {
|
||||
uint32_t b = p[x];
|
||||
uint8_t a = x >> 24;
|
||||
uint8_t a = b >> 24;
|
||||
|
||||
if( a != 0 ) {
|
||||
q[0] = 255 * ((b >> 16) & 255) / a;
|
||||
@ -372,6 +377,8 @@ vips__openslide_generate( VipsRegion *out,
|
||||
|
||||
q += 4;
|
||||
}
|
||||
|
||||
p += r->width;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
@ -420,8 +427,8 @@ vips__openslide_read( const char *filename, VipsImage *out, int level )
|
||||
* 50%.
|
||||
*/
|
||||
if( vips_tilecache( raw, &t,
|
||||
"tile_width", 256,
|
||||
"tile_height", 256,
|
||||
"tile_width", TILE_WIDTH,
|
||||
"tile_height", TILE_HEIGHT,
|
||||
"max_tiles", (int) (1.5 * (1 + raw->Xsize / TILE_WIDTH)),
|
||||
"threaded", TRUE,
|
||||
NULL ) )
|
||||
|
Loading…
Reference in New Issue
Block a user