diff --git a/ChangeLog b/ChangeLog index d168095c..59a860ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +12/5/10 started 7.22.2 +- the conditional image of ifthenelse can be any format, a (!=0) is added if + necessary + 12/5/10 started 7.22.1 - fix a problem with tiff pyramid write and >1cpu, thanks Ruven - constant ops clip to target range diff --git a/configure.in b/configure.in index 07b097a6..a035e61b 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR(m4) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [22]) -m4_define([vips_micro_version], [1]) +m4_define([vips_micro_version], [2]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -29,7 +29,7 @@ PACKAGE=vips # interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=29 -LIBRARY_REVISION=2 +LIBRARY_REVISION=3 LIBRARY_AGE=14 AM_INIT_AUTOMAKE($PACKAGE,$VERSION) diff --git a/libvips/relational/im_ifthenelse.c b/libvips/relational/im_ifthenelse.c index e81e02f7..618ac8d0 100644 --- a/libvips/relational/im_ifthenelse.c +++ b/libvips/relational/im_ifthenelse.c @@ -15,6 +15,9 @@ * - use im_check*() * - allow many-band conditional and single-band a/b * - allow a/b to differ in format and bands + * 25/6/10 + * - let the conditional image be any format by adding a (!=0) if + * necessary */ /* @@ -185,7 +188,7 @@ ifthenelse( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out ) * @b: else #IMAGE * @out: output #IMAGE * - * This operation scans the condition image @c (which must be unsigned char) + * This operation scans the condition image @c * and uses it to select pixels from either the then image @a or the else * image @b. Non-zero means @a, 0 means @b. * @@ -216,6 +219,15 @@ im_ifthenelse( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out ) im__bandalike( t[0], t[1], t[2], t[3] ) ) return( -1 ); + /* If c is not uchar, do (!=0) to make a uchar image. + */ + if( c->BandFmt != IM_BANDFMT_UCHAR ) { + if( im_notequalconst( c, t[4], 0 ) ) + return( -1 ); + + c = t[4]; + } + if( ifthenelse( c, t[2], t[3], out ) ) return( -1 );