reorder load tests

and a slight memory saving on ifthenelse
This commit is contained in:
John Cupitt 2016-01-13 20:32:23 +00:00
parent 52384606dd
commit 6ca9a907b8
14 changed files with 60 additions and 2 deletions

View File

@ -1,5 +1,7 @@
12/1/16 started 8.2.2
- changes to ease compiling C++ binding with MSVC
- reorder file tests to put slow loaders last
- ifthenelse needs less C stack during eval
1/1/16 started 8.2.1
- add a compat stub, thanks Benjamin

View File

@ -437,8 +437,15 @@ vips_ifthenelse_build( VipsObject *object )
/* Condition is cast to uchar, then/else to a common type.
*/
if( vips_cast( size[2], &format[2], VIPS_FORMAT_UCHAR, NULL ) )
return( -1 );
if( size[2]->BandFmt != VIPS_FORMAT_UCHAR ) {
if( vips_cast( size[2], &format[2], VIPS_FORMAT_UCHAR, NULL ) )
return( -1 );
}
else {
format[2] = size[2];
g_object_ref( format[2] );
}
if( vips__formatalike_vec( size, format, 2 ) )
return( -1 );

View File

@ -118,6 +118,10 @@ vips_foreign_load_analyze_class_init( VipsForeignLoadAnalyzeClass *class )
foreign_class->suffs = vips_foreign_analyze_suffs;
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
load_class->is_a = vips__isanalyze;
load_class->get_flags_filename =
vips_foreign_load_analyze_get_flags_filename;

View File

@ -125,6 +125,10 @@ vips_foreign_load_csv_class_init( VipsForeignLoadCsvClass *class )
foreign_class->suffs = vips__foreign_csv_suffs;
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
load_class->get_flags_filename =
vips_foreign_load_csv_get_flags_filename;
load_class->get_flags = vips_foreign_load_csv_get_flags;

View File

@ -109,6 +109,10 @@ vips_foreign_load_fits_class_init( VipsForeignLoadFitsClass *class )
object_class->nickname = "fitsload";
object_class->description = _( "load a FITS image" );
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
foreign_class->suffs = vips__fits_suffs;
load_class->is_a = vips__fits_isfits;

View File

@ -240,6 +240,10 @@ vips_foreign_load_jpeg_file_class_init( VipsForeignLoadJpegFileClass *class )
foreign_class->suffs = jpeg_suffs;
/* We are fast at is_a(), so high priority.
*/
foreign_class->priority = 200;
load_class->get_flags_filename =
vips_foreign_load_jpeg_file_get_flags_filename;
load_class->is_a = vips_foreign_load_jpeg_file_is_a;

View File

@ -138,6 +138,10 @@ vips_foreign_load_matrix_class_init( VipsForeignLoadMatrixClass *class )
foreign_class->suffs = vips__foreign_matrix_suffs;
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
load_class->is_a = vips__matrix_ismatrix;
load_class->get_flags_filename =
vips_foreign_load_matrix_get_flags_filename;

View File

@ -129,6 +129,10 @@ vips_foreign_load_openexr_class_init( VipsForeignLoadOpenexrClass *class )
foreign_class->suffs = vips_foreign_openexr_suffs;
/* We are fast at is_a(), so high priority.
*/
foreign_class->priority = 200;
load_class->is_a = vips__openexr_isexr;
load_class->get_flags_filename =
vips_foreign_load_openexr_get_flags_filename;

View File

@ -129,6 +129,10 @@ vips_foreign_load_png_class_init( VipsForeignLoadPngClass *class )
foreign_class->suffs = vips__png_suffs;
/* We are fast at is_a(), so high priority.
*/
foreign_class->priority = 200;
load_class->is_a = vips__png_ispng;
load_class->get_flags_filename =
vips_foreign_load_png_get_flags_filename;

View File

@ -118,6 +118,10 @@ vips_foreign_load_ppm_class_init( VipsForeignLoadPpmClass *class )
foreign_class->suffs = vips__ppm_suffs;
/* We are fast at is_a(), so high priority.
*/
foreign_class->priority = 200;
load_class->is_a = vips__ppm_isppm;
load_class->get_flags_filename =
vips_foreign_load_ppm_get_flags_filename;

View File

@ -121,6 +121,10 @@ vips_foreign_load_rad_class_init( VipsForeignLoadRadClass *class )
foreign_class->suffs = vips__rad_suffs;
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
load_class->is_a = vips__rad_israd;
load_class->get_flags_filename =
vips_foreign_load_rad_get_flags_filename;

View File

@ -179,6 +179,10 @@ vips_foreign_load_tiff_file_class_init( VipsForeignLoadTiffFileClass *class )
object_class->nickname = "tiffload";
object_class->description = _( "load tiff from file" );
/* We are fast, but must test after openslideload.
*/
foreign_class->priority = 50;
foreign_class->suffs = vips__foreign_tiff_suffs;
load_class->is_a = vips__istiff;

View File

@ -123,6 +123,10 @@ vips_foreign_load_vips_class_init( VipsForeignLoadVipsClass *class )
foreign_class->suffs = vips__suffs;
/* We are fast at is_a(), so high priority.
*/
foreign_class->priority = 200;
load_class->is_a = vips_foreign_load_vips_is_a;
load_class->get_flags = vips_foreign_load_vips_get_flags;
load_class->get_flags_filename =

View File

@ -229,6 +229,7 @@ vips_foreign_load_webp_buffer_class_init(
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
gobject_class->set_property = vips_object_set_property;
@ -237,6 +238,10 @@ vips_foreign_load_webp_buffer_class_init(
object_class->nickname = "webpload_buffer";
object_class->description = _( "load webp from buffer" );
/* is_a() is not that quick ... lower the priority.
*/
foreign_class->priority = -50;
load_class->is_a_buffer = vips__iswebp_buffer;
load_class->header = vips_foreign_load_webp_buffer_header;
load_class->load = vips_foreign_load_webp_buffer_load;