don't cache progressive jpg images

progressive jpg images need loads of memory, we shouldn't cache them by
default ... our called can hold a ref if they want to keep the image
around

see https://github.com/jcupitt/libvips/issues/387
This commit is contained in:
John Cupitt 2016-02-18 19:00:19 +00:00
parent 307895eb41
commit 6f94cb5ed4
3 changed files with 24 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- vipsthumbnail knows about pdfload and svgload
- added @page param to magickload
- matload is more specific (thanks bithive)
- don't cache progressive jpg images
27/1/16 started 8.2.3
- fix a crash with SPARC byte-order labq vips images

View File

@ -928,6 +928,7 @@ static VipsOperationFlags
vips_foreign_load_operation_get_flags( VipsOperation *operation )
{
VipsForeignLoad *load = VIPS_FOREIGN_LOAD( operation );
VipsOperationFlags flags;
flags = VIPS_OPERATION_CLASS( vips_foreign_load_parent_class )->

View File

@ -179,6 +179,25 @@ typedef VipsForeignLoadJpegClass VipsForeignLoadJpegFileClass;
G_DEFINE_TYPE( VipsForeignLoadJpegFile, vips_foreign_load_jpeg_file,
vips_foreign_load_jpeg_get_type() );
static VipsOperationFlags
vips_foreign_load_jpeg_operation_get_flags( VipsOperation *operation )
{
VipsForeignLoad *load = VIPS_FOREIGN_LOAD( operation );
VipsOperationFlags flags;
int multiscan;
flags = VIPS_OPERATION_CLASS( vips_foreign_load_jpeg_parent_class )->
get_flags( operation );
if( load->out &&
!vips_image_get_int( load->out,
"jpeg-multiscan", &multiscan ) &&
multiscan )
flags |= VIPS_OPERATION_NOCACHE;
return( flags );
}
static VipsForeignFlags
vips_foreign_load_jpeg_file_get_flags_filename( const char *filename )
{
@ -229,6 +248,7 @@ vips_foreign_load_jpeg_file_class_init( VipsForeignLoadJpegFileClass *class )
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsOperationClass *operation_class = (VipsOperationClass *) class;
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
@ -238,6 +258,8 @@ vips_foreign_load_jpeg_file_class_init( VipsForeignLoadJpegFileClass *class )
object_class->nickname = "jpegload";
object_class->description = _( "load jpeg from file" );
operation_class->get_flags = vips_foreign_load_jpeg_operation_get_flags;
foreign_class->suffs = jpeg_suffs;
/* We are fast at is_a(), so high priority.