diff --git a/ChangeLog b/ChangeLog index f7543782..3b48c49d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,7 @@ - im_bufjpeg2vips() has a "header_only" parameter - added vips_image_get_data() - updated German translation (thanks Chris) +- fixed typo in im_conv() overflow estimation which could cause errors 30/11/10 started 7.24.0 - bump for new stable diff --git a/libvips/convolution/im_conv.c b/libvips/convolution/im_conv.c index 25bd67b3..4f4ad91c 100644 --- a/libvips/convolution/im_conv.c +++ b/libvips/convolution/im_conv.c @@ -63,6 +63,8 @@ * keeping two versions * 8/11/10 * - add array tiling + * 9/5/11 + * - argh typo in overflow estimation could cause errors */ /* @@ -110,6 +112,9 @@ - make up a signed 8-bit code path? + - don't use divluw, it's insanely slow, instead scale coefficients so + that we can just do >>8 at the end + */ #ifdef HAVE_CONFIG_H @@ -355,10 +360,8 @@ conv_compile_convolution_u8s16( Conv *conv ) for( i = 0; i < n_mask; i++ ) { int v = 255 * mask->coeff[i]; - if( min + v < min ) - min += v; - else if( min + v > max ) - max += v; + min = IM_MIN( min, min + v ); + max = IM_MAX( max, max + v ); if( max > SHRT_MAX ) return( -1 ); @@ -1008,6 +1011,11 @@ im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask ) Conv *conv; im_generate_fn generate; +#ifdef DEBUG + printf( "im_conv_raw: starting with matrix:\n" ); + im_print_imask( mask ); +#endif /*DEBUG*/ + /* Check parameters. */ if( im_piocheck( in, out ) || diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index c61a9c2e..c10b55ee 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -43,8 +43,8 @@ */ /* -#define DEBUG */ +#define DEBUG #ifdef HAVE_CONFIG_H #include @@ -312,7 +312,7 @@ vips_vector_print( VipsVector *vector ) if( vector->compiled ) printf( "successfully compiled\n" ); else - printf( "not compiled successfully\n" ); + printf( "not compiled\n" ); printf( " n_scanline = %d\n", vector->n_scanline ); for( i = 0; i < vector->n_scanline; i++ ) printf( " var %d = line %d\n",