diff --git a/ChangeLog b/ChangeLog index 80f84de1..0ebb3a53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,11 +3,17 @@ - fix pngload with libpng >1.6.1 - add vips_resize() +21/8/14 started 7.40.7 +- fix matlab load +- fix memleak in tilecache [Lovell] +- fix memleak in VipsArray [Lovell] + 12/8/14 started 7.40.6 - more doc fixes - fix similarity rotate+scale, thanks Topochicho - fix 16-bit PNG save, thanks John - fix dzsave date on Windows, thanks John +- fix vipsthumbnail on many-core systems, thanks James 25/7/14 started 7.40.5 - fix a race in im_maxpos_avg() diff --git a/configure.ac b/configure.ac index 423dafb3..e375e4a6 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=38 -LIBRARY_REVISION=4 +LIBRARY_REVISION=5 LIBRARY_AGE=0 # patched into include/vips/version.h diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index 69c88487..1634cdf1 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -29,6 +29,8 @@ * - could deadlock if downstream raised an error (thanks Todd) * 25/4/13 * - cache minimisation is optional, see "persistent" flag + * 26/8/14 Lovell + * - free the hash table in _dispose() */ /* @@ -156,6 +158,10 @@ vips_block_cache_dispose( GObject *gobject ) VIPS_FREEF( vips_g_mutex_free, cache->lock ); VIPS_FREEF( vips_g_cond_free, cache->new_tile ); + if( cache->tiles ) + g_assert( g_hash_table_size( cache->tiles ) == 0 ); + VIPS_FREEF( g_hash_table_destroy, cache->tiles ); + G_OBJECT_CLASS( vips_block_cache_parent_class )->dispose( gobject ); } @@ -941,7 +947,7 @@ vips_line_cache_build( VipsObject *object ) vips_get_tile_size( block_cache->in, &tile_width, &tile_height, &nlines ); - block_cache->max_tiles = 3 * + block_cache->max_tiles = 4 * (1 + nlines / block_cache->tile_height); VIPS_DEBUG_MSG( "vips_line_cache_build: nlines = %d\n", diff --git a/libvips/foreign/matlab.c b/libvips/foreign/matlab.c index fce0b5ee..a0f06a82 100644 --- a/libvips/foreign/matlab.c +++ b/libvips/foreign/matlab.c @@ -4,6 +4,9 @@ * - transpose on load, assemble planes into bands (thanks Mikhail) * 20/12/11 * - reworked as some fns ready for new-style classes + * 21/8/14 + * - swap width/height + * - set interpretation to rgb16 etc. */ /* @@ -150,6 +153,28 @@ static int mat2vips_formats[][2] = { { MAT_C_DOUBLE, VIPS_FORMAT_DOUBLE } }; +/* Pick an interpretation. + */ +static VipsInterpretation +mat2vips_pick_interpretation( int bands, VipsBandFormat format ) +{ + if( bands == 3 && + vips_band_format_is8bit( format ) ) + return( VIPS_INTERPRETATION_sRGB ); + if( bands == 3 && + (format == VIPS_FORMAT_USHORT || + format == VIPS_FORMAT_SHORT) ) + return( VIPS_INTERPRETATION_RGB16 ); + if( bands == 1 && + (format == VIPS_FORMAT_USHORT || + format == VIPS_FORMAT_SHORT) ) + return( VIPS_INTERPRETATION_GREY16 ); + if( bands > 1 ) + return( VIPS_INTERPRETATION_MULTIBAND ); + + return( VIPS_INTERPRETATION_MULTIBAND ); +} + static int mat2vips_get_header( matvar_t *var, VipsImage *im ) { @@ -165,10 +190,10 @@ mat2vips_get_header( matvar_t *var, VipsImage *im ) bands = var->dims[2]; case 2: - height = var->dims[1]; + width = var->dims[1]; case 1: - width = var->dims[0]; + height = var->dims[0]; break; default: @@ -177,11 +202,6 @@ mat2vips_get_header( matvar_t *var, VipsImage *im ) return( -1 ); } - if( bands > 1 ) - interpretation = VIPS_INTERPRETATION_MULTIBAND; - else - interpretation = VIPS_INTERPRETATION_B_W; - for( i = 0; i < VIPS_NUMBER( mat2vips_formats ); i++ ) if( mat2vips_formats[i][0] == var->class_type ) break; @@ -191,6 +211,7 @@ mat2vips_get_header( matvar_t *var, VipsImage *im ) return( -1 ); } format = mat2vips_formats[i][1]; + interpretation = mat2vips_pick_interpretation( bands, format ); vips_image_init_fields( im, width, height, bands, diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index 8206dd71..897f55cc 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -334,6 +334,7 @@ vips_area_free_array_object( GObject **array, VipsArea *area ) for( i = 0; i < area->n; i++ ) VIPS_FREEF( g_object_unref, array[i] ); + VIPS_FREE( array ); area->n = 0; } diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index d4a66e3f..cb250fc2 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -318,8 +318,10 @@ thumbnail_open( VipsObject *process, const char *filename ) "loading jpeg with factor %d pre-shrink", jpegshrink ); + /* We can't use UNBUFERRED safely on very-many-core systems. + */ if( !(im = vips_image_new_from_file( filename, - "access", VIPS_ACCESS_SEQUENTIAL_UNBUFFERED, + "access", VIPS_ACCESS_SEQUENTIAL, "shrink", jpegshrink, NULL )) ) return( NULL ); @@ -328,7 +330,7 @@ thumbnail_open( VipsObject *process, const char *filename ) /* All other formats. */ if( !(im = vips_image_new_from_file( filename, - "access", VIPS_ACCESS_SEQUENTIAL_UNBUFFERED, + "access", VIPS_ACCESS_SEQUENTIAL, NULL )) ) return( NULL ); }