diff --git a/ChangeLog b/ChangeLog index bccf96e4..2807b6d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,20 @@ 19/3/12 started 7.29.0 -- better PNG alpha handling - sanity-check PNG read geometry - nearest-neighbor interpolation rounds coordinates to nearest instead of rounding down (thanks Nicolas) - add dzsave, save in deep zoom format - rework im_shrink() as a class - remove im_rightshift_size(), just a convenience function now -- fix write RGBA as JPG (thanks Tobias) + +18/6/12 started 7.28.8 +- fixes for centos5 portability 18/6/12 started 7.28.7 - add vips_flatten() -- flatten RGBA to RGB - better alpha handling in PNG load - don't save RGBA PNG as CMYK JPG (thanks Tobsn) - fix a crash with malformed jpg files (thanks Grigoriy) +- vipsthumbnail enables sequential mode more and caches lines better 19/4/12 started 7.28.6 - better resolution unit handling in deprecated im_vips2tiff() diff --git a/configure.in b/configure.in index 9d940031..2db4f814 100644 --- a/configure.in +++ b/configure.in @@ -35,7 +35,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=33 -LIBRARY_REVISION=0 +LIBRARY_REVISION=1 LIBRARY_AGE=1 # patched into include/vips/version.h @@ -551,7 +551,8 @@ if test x"$with_tiff" != "xno"; then [AC_DEFINE(HAVE_TIFF,1,[define if you have libtiff installed.]) with_tiff=yes PACKAGES_USED="$PACKAGES_USED libtiff-4"], - [FIND_TIFF(, + [FIND_TIFF( + with_tiff=yes, [AC_MSG_WARN([libtiff not found; disabling TIFF support]) with_tiff=no ]) @@ -567,7 +568,8 @@ if test x"$with_png" != "xno"; then [AC_DEFINE(HAVE_PNG,1,[define if you have libpng installed.]) with_png=yes PACKAGES_USED="$PACKAGES_USED libpng"], - [FIND_PNG(, + [FIND_PNG( + with_png=yes, [AC_MSG_WARN([libpng not found; disabling PNG support]) with_png=no ]) diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index 67ea5273..60c8a7cd 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -1,4 +1,7 @@ /* cache vips operations + * + * 20/6/12 + * - try to make it compile on centos5 */ /* @@ -100,6 +103,14 @@ static GHashTable *vips_cache_table = NULL; */ static int vips_cache_time = 0; +/* glib-2.22+ has has funcs for double and int64 hash, but we want to work on + * centos 5 which is 2.12. Switch to g_double_hash() and g_int64_hash() when + * we abandon 5. + */ + +#define INT64_HASH(X) (((unsigned int *)(X))[0] ^ ((unsigned int *)(X))[1]) +#define DOUBLE_HASH(X) (INT64_HASH(X)) + /* Pass in the pspec so we can get the generic type. For example, a * held in a GParamSpec allowing OBJECT, but the value could be of type * VipsImage. generics are much faster to compare. @@ -134,12 +145,12 @@ vips_value_hash( GParamSpec *pspec, GValue *value ) else if( generic == G_TYPE_PARAM_UINT64 ) { guint64 i = g_value_get_uint64( value ); - return( g_int64_hash( (gint64 *) &i ) ); + return( INT64_HASH( (gint64 *) &i ) ); } else if( generic == G_TYPE_PARAM_INT64 ) { gint64 i = g_value_get_int64( value ); - return( g_int64_hash( &i ) ); + return( INT64_HASH( &i ) ); } else if( generic == G_TYPE_PARAM_FLOAT ) { float f = g_value_get_float( value ); @@ -149,7 +160,7 @@ vips_value_hash( GParamSpec *pspec, GValue *value ) else if( generic == G_TYPE_PARAM_DOUBLE ) { double d = g_value_get_double( value ); - return( g_double_hash( &d ) ); + return( DOUBLE_HASH( &d ) ); } else if( generic == G_TYPE_PARAM_STRING ) { const char *s = g_value_get_string( value ); @@ -416,23 +427,26 @@ vips_cache_init( void ) } } +static void * +vips_cache_dump_fn( void *value, void *a, void *b ) +{ + char str[32768]; + VipsBuf buf = VIPS_BUF_STATIC( str ); + + vips_object_to_string( VIPS_OBJECT( value ), &buf ); + + printf( "%p - %s\n", value, vips_buf_all( &buf ) ); + + return( NULL ); +} + static void vips_cache_dump( void ) { if( vips_cache_table ) { - GHashTableIter iter; - gpointer key, value; - printf( "Operation cache:\n" ); - g_hash_table_iter_init( &iter, vips_cache_table ); - while( g_hash_table_iter_next( &iter, &key, &value ) ) { - char str[32768]; - VipsBuf buf = VIPS_BUF_STATIC( str ); - - vips_object_to_string( VIPS_OBJECT( key ), &buf ); - - printf( "%p - %s\n", key, vips_buf_all( &buf ) ); - } + vips_hash_table_map( vips_cache_table, + vips_cache_dump_fn, NULL, NULL ); } } @@ -485,6 +499,24 @@ vips_cache_drop( VipsOperation *operation ) vips_cache_unref( operation ); } +static void * +vips_cache_first_fn( void *value, void *a, void *b ) +{ + return( value ); +} + +/* Return the first item. + */ +static VipsOperation * +vips_cache_first( void ) +{ + if( vips_cache_table ) + return( VIPS_OPERATION( vips_hash_table_map( vips_cache_table, + vips_cache_first_fn, NULL, NULL ) ) ); + else + return( NULL ); +} + /** * vips_cache_drop_all: * @@ -494,6 +526,8 @@ void vips_cache_drop_all( void ) { if( vips_cache_table ) { + VipsOperation *operation; + if( vips__cache_dump ) vips_cache_dump(); @@ -501,16 +535,8 @@ vips_cache_drop_all( void ) * g_hash_table_foreach() and friends. Repeatedly drop the * first item instead. */ - for(;;) { - GHashTableIter iter; - gpointer key, value; - - g_hash_table_iter_init( &iter, vips_cache_table ); - if( !g_hash_table_iter_next( &iter, &key, &value ) ) - break; - - vips_cache_drop( (VipsOperation *) key ); - } + while( (operation = vips_cache_first()) ) + vips_cache_drop( operation ); VIPS_FREEF( g_hash_table_unref, vips_cache_table ); } diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index 61a3baeb..041e7bd7 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -249,7 +249,7 @@ typedef struct { static gboolean vips_hash_table_predicate( const char *key, void *value, Pair *pair ) { - return( (pair->result == pair->fn( value, pair->a, pair->b )) ); + return( (pair->result = pair->fn( value, pair->a, pair->b )) != NULL ); } /* Like slist map, but for a hash table. diff --git a/po/POTFILES.in b/po/POTFILES.in index 8891591c..5ac44641 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -67,6 +67,7 @@ libvips/conversion/im_gaussnoise.c libvips/conversion/bandary.c libvips/conversion/cast.c libvips/conversion/conversion.c +libvips/conversion/flatten.c libvips/conversion/im_subsample.c libvips/conversion/im_grid.c libvips/conversion/extract.c @@ -104,6 +105,7 @@ libvips/convolution/convol_dispatch.c libvips/convolution/im_aconv.c libvips/convolution/im_addgnoise.c libvips/convolution/im_sharpen.c +libvips/dummy.c libvips/foreign/rawsave.c libvips/foreign/radload.c libvips/foreign/tiffload.c @@ -312,6 +314,7 @@ libvips/include/vips/generate.h libvips/include/vips/arithmetic.h libvips/include/vips/version.h libvips/include/vips/util.h +libvips/include/vips/almostdeprecated.h libvips/include/vips/colour.h libvips/include/vips/threadpool.h libvips/include/vips/vector.h @@ -331,6 +334,7 @@ libvips/include/vips/interpolate.h libvips/include/vips/private.h libvips/include/vips/format.h libvips/include/vips/object.h +libvips/include/vips/deprecated.h libvips/include/vips/inlines.h libvips/include/vips/histograms_lut.h libvips/include/vips/other.h diff --git a/po/vips7.pot b/po/vips7.pot index db828e52..054059a4 100644 --- a/po/vips7.pot +++ b/po/vips7.pot @@ -48,7 +48,7 @@ msgstr "" #: ../libvips/arithmetic/stats.c:423 ../libvips/arithmetic/deviate.c:219 #: ../libvips/arithmetic/arithmetic.c:382 ../libvips/arithmetic/min.c:325 #: ../libvips/arithmetic/max.c:324 ../libvips/conversion/conversion.c:89 -#: ../libvips/foreign/foreign.c:897 +#: ../libvips/foreign/foreign.c:903 msgid "Output" msgstr "" @@ -391,13 +391,13 @@ msgstr "" #: ../libvips/arithmetic/unary.c:87 ../libvips/arithmetic/statistic.c:151 #: ../libvips/conversion/flip.c:240 ../libvips/conversion/bandmean.c:197 -#: ../libvips/conversion/cast.c:476 ../libvips/conversion/extract.c:194 -#: ../libvips/conversion/extract.c:353 ../libvips/conversion/bandjoin.c:171 -#: ../libvips/conversion/copy.c:318 ../libvips/conversion/rot.c:355 -#: ../libvips/conversion/replicate.c:196 ../libvips/conversion/tilecache.c:422 -#: ../libvips/conversion/embed.c:516 ../libvips/conversion/cache.c:106 -#: ../libvips/conversion/recomb.c:200 ../libvips/conversion/sequential.c:153 -#: ../libvips/foreign/foreign.c:1379 +#: ../libvips/conversion/cast.c:476 ../libvips/conversion/flatten.c:372 +#: ../libvips/conversion/extract.c:194 ../libvips/conversion/extract.c:353 +#: ../libvips/conversion/bandjoin.c:171 ../libvips/conversion/copy.c:318 +#: ../libvips/conversion/rot.c:355 ../libvips/conversion/replicate.c:196 +#: ../libvips/conversion/tilecache.c:422 ../libvips/conversion/embed.c:516 +#: ../libvips/conversion/cache.c:106 ../libvips/conversion/recomb.c:200 +#: ../libvips/conversion/sequential.c:153 ../libvips/foreign/foreign.c:1410 msgid "Input" msgstr "" @@ -438,7 +438,7 @@ msgid "arithmetic operations" msgstr "" #: ../libvips/arithmetic/arithmetic.c:383 -#: ../libvips/conversion/conversion.c:90 ../libvips/foreign/foreign.c:898 +#: ../libvips/conversion/conversion.c:90 ../libvips/foreign/foreign.c:904 msgid "Output image" msgstr "" @@ -562,11 +562,12 @@ msgid "VIPS statistic operations" msgstr "" #: ../libvips/arithmetic/statistic.c:152 ../libvips/conversion/flip.c:241 -#: ../libvips/conversion/cast.c:477 ../libvips/conversion/extract.c:195 -#: ../libvips/conversion/extract.c:354 ../libvips/conversion/copy.c:319 -#: ../libvips/conversion/rot.c:356 ../libvips/conversion/replicate.c:197 -#: ../libvips/conversion/tilecache.c:423 ../libvips/conversion/embed.c:517 -#: ../libvips/conversion/cache.c:107 ../libvips/conversion/sequential.c:154 +#: ../libvips/conversion/cast.c:477 ../libvips/conversion/flatten.c:373 +#: ../libvips/conversion/extract.c:195 ../libvips/conversion/extract.c:354 +#: ../libvips/conversion/copy.c:319 ../libvips/conversion/rot.c:356 +#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:423 +#: ../libvips/conversion/embed.c:517 ../libvips/conversion/cache.c:107 +#: ../libvips/conversion/sequential.c:154 msgid "Input image" msgstr "" @@ -794,6 +795,19 @@ msgstr "" msgid "conversion operations" msgstr "" +#: ../libvips/conversion/flatten.c:368 +msgid "flatten alpha out of an image" +msgstr "" + +#: ../libvips/conversion/flatten.c:378 ../libvips/conversion/join.c:247 +#: ../libvips/conversion/insert.c:386 +msgid "Background" +msgstr "" + +#: ../libvips/conversion/flatten.c:379 +msgid "Background value" +msgstr "" + #: ../libvips/conversion/im_subsample.c:202 msgid "factors should both be >= 1" msgstr "" @@ -1029,10 +1043,6 @@ msgstr "" msgid "Pixels between images" msgstr "" -#: ../libvips/conversion/join.c:247 ../libvips/conversion/insert.c:386 -msgid "Background" -msgstr "" - #: ../libvips/conversion/join.c:248 ../libvips/conversion/insert.c:387 msgid "Colour for new pixels" msgstr "" @@ -1408,20 +1418,20 @@ msgstr "" msgid "datatype %d not supported" msgstr "" -#: ../libvips/foreign/jpeg2vips.c:167 +#: ../libvips/foreign/jpeg2vips.c:166 #, c-format msgid "read gave %ld warnings" msgstr "" -#: ../libvips/foreign/jpeg2vips.c:489 +#: ../libvips/foreign/jpeg2vips.c:486 msgid "error reading resolution" msgstr "" -#: ../libvips/foreign/jpeg2vips.c:510 +#: ../libvips/foreign/jpeg2vips.c:507 msgid "unknown EXIF resolution unit" msgstr "" -#: ../libvips/foreign/jpeg2vips.c:718 +#: ../libvips/foreign/jpeg2vips.c:715 msgid "unknown JFIF resolution unit" msgstr "" @@ -1429,7 +1439,7 @@ msgstr "" msgid "error reading radiance header" msgstr "" -#: ../libvips/foreign/radiance.c:959 ../libvips/foreign/tiff2vips.c:1343 +#: ../libvips/foreign/radiance.c:959 ../libvips/foreign/tiff2vips.c:1347 msgid "read error" msgstr "" @@ -1709,91 +1719,94 @@ msgstr "" msgid "EXR error: %s" msgstr "" -#: ../libvips/foreign/tiff2vips.c:265 ../libvips/foreign/tiff2vips.c:288 -#: ../libvips/foreign/tiff2vips.c:306 +#: ../libvips/foreign/tiff2vips.c:269 ../libvips/foreign/tiff2vips.c:287 #, c-format msgid "required field %d missing" msgstr "" -#: ../libvips/foreign/tiff2vips.c:269 +#: ../libvips/foreign/tiff2vips.c:307 #, c-format -msgid "required field %d=%d, not %d" +msgid "required field %d = %d, not %d" msgstr "" -#: ../libvips/foreign/tiff2vips.c:653 +#: ../libvips/foreign/tiff2vips.c:651 #, c-format msgid "%d bits per sample palette image not supported" msgstr "" -#: ../libvips/foreign/tiff2vips.c:662 +#: ../libvips/foreign/tiff2vips.c:660 msgid "bad colormap" msgstr "" -#: ../libvips/foreign/tiff2vips.c:719 ../libvips/foreign/tiff2vips.c:750 +#: ../libvips/foreign/tiff2vips.c:717 ../libvips/foreign/tiff2vips.c:748 msgid "3 or 4 bands RGB TIFF only" msgstr "" -#: ../libvips/foreign/tiff2vips.c:821 +#: ../libvips/foreign/tiff2vips.c:819 msgid "4 or 5 bands CMYK TIFF only" msgstr "" -#: ../libvips/foreign/tiff2vips.c:872 +#: ../libvips/foreign/tiff2vips.c:870 msgid "unknown resolution unit" msgstr "" -#: ../libvips/foreign/tiff2vips.c:877 +#: ../libvips/foreign/tiff2vips.c:875 #, c-format msgid "" "no resolution information for TIFF image \"%s\" -- defaulting to 1 pixel per " "mm" msgstr "" -#: ../libvips/foreign/tiff2vips.c:949 +#: ../libvips/foreign/tiff2vips.c:907 +msgid "not a PLANARCONFIG_CONTIG image" +msgstr "" + +#: ../libvips/foreign/tiff2vips.c:953 #, c-format msgid "unsupported sample format %d for lab image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:959 +#: ../libvips/foreign/tiff2vips.c:963 #, c-format msgid "unsupported depth %d for LAB image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:998 +#: ../libvips/foreign/tiff2vips.c:1002 #, c-format msgid "unsupported sample format %d for greyscale image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1007 +#: ../libvips/foreign/tiff2vips.c:1011 #, c-format msgid "unsupported depth %d for greyscale image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1055 +#: ../libvips/foreign/tiff2vips.c:1059 #, c-format msgid "unsupported sample format %d for rgb image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1064 +#: ../libvips/foreign/tiff2vips.c:1068 #, c-format msgid "unsupported depth %d for RGB image" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1078 +#: ../libvips/foreign/tiff2vips.c:1082 #, c-format msgid "unknown photometric interpretation %d" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1456 +#: ../libvips/foreign/tiff2vips.c:1465 #, c-format msgid "bad page number %d" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1477 ../libvips/foreign/vips2tiff.c:289 +#: ../libvips/foreign/tiff2vips.c:1486 ../libvips/foreign/vips2tiff.c:289 #, c-format msgid "unable to open \"%s\" for input" msgstr "" -#: ../libvips/foreign/tiff2vips.c:1532 ../libvips/foreign/tiff2vips.c:1562 +#: ../libvips/foreign/tiff2vips.c:1541 ../libvips/foreign/tiff2vips.c:1571 #, c-format msgid "TIFF file does not contain page %d" msgstr "" @@ -1973,62 +1986,62 @@ msgstr "" msgid "1 to 5 bands only" msgstr "" -#: ../libvips/foreign/foreign.c:384 +#: ../libvips/foreign/foreign.c:386 msgid "load and save image files" msgstr "" -#: ../libvips/foreign/foreign.c:525 ../libvips/mosaicing/im_remosaic.c:76 +#: ../libvips/foreign/foreign.c:527 ../libvips/mosaicing/im_remosaic.c:76 #, c-format msgid "file \"%s\" not found" msgstr "" -#: ../libvips/foreign/foreign.c:534 ../libvips/foreign/foreign.c:1022 +#: ../libvips/foreign/foreign.c:536 ../libvips/foreign/foreign.c:1030 #, c-format msgid "\"%s\" is not a known file format" msgstr "" -#: ../libvips/foreign/foreign.c:740 +#: ../libvips/foreign/foreign.c:746 msgid "images do not match" msgstr "" -#: ../libvips/foreign/foreign.c:826 +#: ../libvips/foreign/foreign.c:832 msgid "" "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL both set -- using SEQUENTIAL" msgstr "" -#: ../libvips/foreign/foreign.c:894 +#: ../libvips/foreign/foreign.c:900 msgid "file loaders" msgstr "" -#: ../libvips/foreign/foreign.c:903 +#: ../libvips/foreign/foreign.c:909 msgid "Flags" msgstr "" -#: ../libvips/foreign/foreign.c:904 +#: ../libvips/foreign/foreign.c:910 msgid "Flags for this file" msgstr "" -#: ../libvips/foreign/foreign.c:910 +#: ../libvips/foreign/foreign.c:916 msgid "Disc" msgstr "" -#: ../libvips/foreign/foreign.c:911 +#: ../libvips/foreign/foreign.c:917 msgid "Open to disc" msgstr "" -#: ../libvips/foreign/foreign.c:917 +#: ../libvips/foreign/foreign.c:923 msgid "Sequential" msgstr "" -#: ../libvips/foreign/foreign.c:918 +#: ../libvips/foreign/foreign.c:924 msgid "Sequential read only" msgstr "" -#: ../libvips/foreign/foreign.c:1370 +#: ../libvips/foreign/foreign.c:1401 msgid "file savers" msgstr "" -#: ../libvips/foreign/foreign.c:1380 +#: ../libvips/foreign/foreign.c:1411 msgid "Image to save" msgstr "" @@ -2261,7 +2274,7 @@ msgid "per-thread state for sinkdisc" msgstr "" #: ../libvips/iofuncs/sinkdisc.c:236 ../libvips/iofuncs/sinkscreen.c:537 -#: ../libvips/iofuncs/threadpool.c:606 +#: ../libvips/iofuncs/threadpool.c:640 msgid "unable to create thread" msgstr "" @@ -2950,12 +2963,12 @@ msgstr "" msgid "extra tokens after ')'" msgstr "" -#: ../libvips/iofuncs/threadpool.c:217 +#: ../libvips/iofuncs/threadpool.c:251 #, c-format msgid "threads clipped to %d" msgstr "" -#: ../libvips/iofuncs/threadpool.c:281 +#: ../libvips/iofuncs/threadpool.c:315 msgid "per-thread state for vipsthreadpool" msgstr "" @@ -3423,55 +3436,55 @@ msgstr "" msgid "unknown action \"%s\"" msgstr "" -#: ../tools/vipsthumbnail.c:54 +#: ../tools/vipsthumbnail.c:56 msgid "set thumbnail size to SIZE" msgstr "" -#: ../tools/vipsthumbnail.c:55 +#: ../tools/vipsthumbnail.c:57 msgid "SIZE" msgstr "" -#: ../tools/vipsthumbnail.c:57 +#: ../tools/vipsthumbnail.c:59 msgid "set output to FORMAT" msgstr "" -#: ../tools/vipsthumbnail.c:58 +#: ../tools/vipsthumbnail.c:60 msgid "FORMAT" msgstr "" -#: ../tools/vipsthumbnail.c:60 +#: ../tools/vipsthumbnail.c:62 msgid "resample with INTERPOLATOR" msgstr "" -#: ../tools/vipsthumbnail.c:61 +#: ../tools/vipsthumbnail.c:63 msgid "INTERPOLATOR" msgstr "" -#: ../tools/vipsthumbnail.c:63 +#: ../tools/vipsthumbnail.c:65 msgid "don't sharpen thumbnail" msgstr "" -#: ../tools/vipsthumbnail.c:65 +#: ../tools/vipsthumbnail.c:67 msgid "export with PROFILE" msgstr "" -#: ../tools/vipsthumbnail.c:66 ../tools/vipsthumbnail.c:69 +#: ../tools/vipsthumbnail.c:68 ../tools/vipsthumbnail.c:71 msgid "PROFILE" msgstr "" -#: ../tools/vipsthumbnail.c:68 +#: ../tools/vipsthumbnail.c:70 msgid "import untagged images with PROFILE" msgstr "" -#: ../tools/vipsthumbnail.c:71 +#: ../tools/vipsthumbnail.c:73 msgid "don't delete profile from exported image" msgstr "" -#: ../tools/vipsthumbnail.c:73 +#: ../tools/vipsthumbnail.c:75 msgid "verbose output" msgstr "" -#: ../tools/vipsthumbnail.c:412 +#: ../tools/vipsthumbnail.c:416 msgid "- thumbnail generator" msgstr ""