diff --git a/ChangeLog b/ChangeLog index 117b9e91..ceedaa23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ 20/7/12 started 7.30.0 -- version bump +- support "rs" mode in vips7 19/3/12 started 7.29.0 - sanity-check PNG read geometry diff --git a/TODO b/TODO index e4e24aca..467bb106 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,13 @@ +- try: + + vipsthumbnail wtc.tif --verbose --vips-progress --vips-leak + + get no progress info + + does not report static interpolators on exit, shouldn't leak check do + this? + + blocking bugs ============= diff --git a/libvips/deprecated/dispatch_types.c b/libvips/deprecated/dispatch_types.c index 72147afe..de103d7a 100644 --- a/libvips/deprecated/dispatch_types.c +++ b/libvips/deprecated/dispatch_types.c @@ -110,7 +110,7 @@ input_image_init( im_object *obj, char *str ) { IMAGE **im = (IMAGE **) obj; - return( !(*im = vips__deprecated_open_read( str )) ); + return( !(*im = vips__deprecated_open_read( str, FALSE )) ); } /* Input image type. diff --git a/libvips/deprecated/im_jpeg2vips.c b/libvips/deprecated/im_jpeg2vips.c index 82fe29d5..d4c677eb 100644 --- a/libvips/deprecated/im_jpeg2vips.c +++ b/libvips/deprecated/im_jpeg2vips.c @@ -58,6 +58,7 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) char mode[FILENAME_MAX]; char *p, *q; int shrink; + int seq; gboolean fail_on_warn; /* By default, we ignore any warnings. We want to get as much of @@ -70,6 +71,7 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) im_filename_split( name, filename, mode ); p = &mode[0]; shrink = 1; + seq = 0; if( (q = im_getnextoption( &p )) ) { shrink = atoi( q ); @@ -84,13 +86,9 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) if( im_isprefix( "fail", q ) ) fail_on_warn = TRUE; } - - /* vips__jpeg_read_file() is always sequential. Parse the option, but - * don't use it. - */ if( (q = im_getnextoption( &p )) ) { if( im_isprefix( "seq", q ) ) - ; + seq = 1; } /* Don't use vips_jpegload() ... we call the jpeg func directly in @@ -106,6 +104,7 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) */ if( !header_only && + !seq && out->dtype == VIPS_IMAGE_PARTIAL ) { if( vips__image_wio_output( out ) ) return( -1 ); diff --git a/libvips/deprecated/im_png2vips.c b/libvips/deprecated/im_png2vips.c index b169c154..0475b982 100644 --- a/libvips/deprecated/im_png2vips.c +++ b/libvips/deprecated/im_png2vips.c @@ -52,13 +52,15 @@ png2vips( const char *name, IMAGE *out, gboolean header_only ) char filename[FILENAME_MAX]; char mode[FILENAME_MAX]; char *p, *q; + int seq; im_filename_split( name, filename, mode ); + seq = 0; p = &mode[0]; if( (q = im_getnextoption( &p )) ) { if( im_isprefix( "seq", q ) ) - ; + seq = 1; } /* We need to be compatible with the pre-sequential mode @@ -72,6 +74,7 @@ png2vips( const char *name, IMAGE *out, gboolean header_only ) */ if( !header_only && + !seq && out->dtype == VIPS_IMAGE_PARTIAL ) { if( vips__image_wio_output( out ) ) return( -1 ); diff --git a/libvips/deprecated/im_tiff2vips.c b/libvips/deprecated/im_tiff2vips.c index f385c8fe..acb899cd 100644 --- a/libvips/deprecated/im_tiff2vips.c +++ b/libvips/deprecated/im_tiff2vips.c @@ -57,17 +57,19 @@ tiff2vips( const char *name, IMAGE *out, gboolean header_only ) char mode[FILENAME_MAX]; char *p, *q; int page; + int seq; im_filename_split( name, filename, mode ); page = 0; + seq = 0; p = &mode[0]; if( (q = im_getnextoption( &p )) ) { page = atoi( q ); } if( (q = im_getnextoption( &p )) ) { if( im_isprefix( "seq", q ) ) - ; + seq = 1; } /* We need to be compatible with the pre-sequential mode @@ -82,6 +84,7 @@ tiff2vips( const char *name, IMAGE *out, gboolean header_only ) */ if( !header_only && + !seq && !vips__istifftiled( filename ) && out->dtype == VIPS_IMAGE_PARTIAL ) { if( vips__image_wio_output( out ) ) diff --git a/libvips/deprecated/lazy.c b/libvips/deprecated/lazy.c index af2595a1..dcc86c2e 100644 --- a/libvips/deprecated/lazy.c +++ b/libvips/deprecated/lazy.c @@ -63,7 +63,7 @@ typedef struct { VipsImage *image; VipsFormatClass *format;/* Read in pixels with this */ char *filename; /* Get pixels from here */ - gboolean disc; /* Read via disc requested */ + gboolean sequential; /* Sequential read requested */ VipsImage *real; /* The real decompressed image */ } Lazy; @@ -80,7 +80,7 @@ lazy_free_cb( VipsImage *image, Lazy *lazy ) static Lazy * lazy_new( VipsImage *image, - VipsFormatClass *format, const char *filename, gboolean disc ) + VipsFormatClass *format, const char *filename, gboolean sequential ) { Lazy *lazy; @@ -89,7 +89,7 @@ lazy_new( VipsImage *image, lazy->image = image; lazy->format = format; lazy->filename = g_strdup( filename ); - lazy->disc = disc; + lazy->sequential = sequential; lazy->real = NULL; g_signal_connect( image, "close", G_CALLBACK( lazy_free_cb ), lazy ); @@ -132,13 +132,13 @@ lazy_real_image( Lazy *lazy ) VipsImage *real; /* We open via disc if: - * - 'disc' is set + * - 'sequential' is not set * - disc_threshold() has not been set to zero * - the format does not support lazy read * - the uncompressed image will be larger than disc_threshold() */ real = NULL; - if( lazy->disc && + if( !lazy->sequential && disc_threshold() && !(vips_format_get_flags( lazy->format, lazy->filename ) & VIPS_FORMAT_PARTIAL) && @@ -203,11 +203,11 @@ open_lazy_generate( VipsRegion *or, */ static int vips_image_open_lazy( VipsImage *image, - VipsFormatClass *format, const char *filename, gboolean disc ) + VipsFormatClass *format, const char *filename, gboolean sequential ) { Lazy *lazy; - lazy = lazy_new( image, format, filename, disc ); + lazy = lazy_new( image, format, filename, sequential ); /* Is there a ->header() function? We need to do a lazy load. */ @@ -273,7 +273,7 @@ vips_attach_save( VipsImage *image, int (*save_fn)(), const char *filename ) } IMAGE * -vips__deprecated_open_read( const char *filename ) +vips__deprecated_open_read( const char *filename, gboolean sequential ) { VipsFormatClass *format; @@ -293,7 +293,8 @@ vips__deprecated_open_read( const char *filename ) IMAGE *image; image = vips_image_new(); - if( vips_image_open_lazy( image, format, filename, TRUE ) ) { + if( vips_image_open_lazy( image, format, + filename, sequential ) ) { g_object_unref( image ); return( NULL ); } diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 375f5fb6..274bc4b9 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -62,10 +62,16 @@ im_open( const char *filename, const char *mode ) /* We have to go via the old VipsFormat system so we can support the * "filename:option" syntax. + * + * Use "rs" to turn on seq mode. */ if( strcmp( mode, "r" ) == 0 || strcmp( mode, "rd" ) == 0 ) { - if( !(image = vips__deprecated_open_read( filename )) ) + if( !(image = vips__deprecated_open_read( filename, FALSE )) ) + return( NULL ); + } + else if( strcmp( mode, "rs" ) == 0 ) { + if( !(image = vips__deprecated_open_read( filename, TRUE )) ) return( NULL ); } else if( strcmp( mode, "w" ) == 0 ) { diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index 937a60fa..130481fe 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -297,7 +297,7 @@ void vips_foreign_operation_init( void ); guint64 vips__parse_size( const char *size_string ); -IMAGE *vips__deprecated_open_read( const char *filename ); +IMAGE *vips__deprecated_open_read( const char *filename, gboolean sequential ); IMAGE *vips__deprecated_open_write( const char *filename ); #ifdef __cplusplus